home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 May: Tool Chest / Dev.CD May 00 TC.toast / pc / tool chest / macapp / macapp r14d5 / install macapp r14d5 / Apple Frameworks / WASTE / Source / WELineLayout.c < prev    next >
MacBinary  |  2000-02-25  |  15.8 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Fri Feb 25 05:00:00 2000, modified Fri Feb 25 05:00:00 2000, creator 'CWIE', type ASCII, 15533 bytes "WELineLayout.c" , at 0x3d2d 286 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0e 57 45 4c 69 6e 65 | 4c 61 79 6f 75 74 2e 63 |..WELine|Layout.c|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 3c ad 00 | 00 01 1e b4 dc 03 20 b4 |.....<..|...... .|
|00000060| dc 03 20 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.. .....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 9c d6 00 00 |........|........|
|00000080| 2f 2a 0d 20 2a 09 57 45 | 4c 69 6e 65 4c 61 79 6f |/*. *.WE|LineLayo|
|00000090| 75 74 2e 63 0d 20 2a 0d | 20 2a 09 57 41 53 54 45 |ut.c. *.| *.WASTE|
|000000a0| 20 50 52 4f 4a 45 43 54 | 0d 20 2a 20 20 4c 69 6e | PROJECT|. * Lin|
|000000b0| 65 20 4c 61 79 6f 75 74 | 2c 20 47 65 74 74 69 6e |e Layout|, Gettin|
|000000c0| 67 20 61 6e 64 20 53 65 | 74 74 69 6e 67 20 56 61 |g and Se|tting Va|
|000000d0| 72 69 61 62 6c 65 73 2c | 20 65 74 63 2e 0d 20 2a |riables,| etc.. *|
|000000e0| 0d 20 2a 20 20 43 6f 70 | 79 72 69 67 68 74 20 28 |. * Cop|yright (|
|000000f0| 63 29 20 31 39 39 33 2d | 31 39 39 38 20 4d 61 72 |c) 1993-|1998 Mar|
|00000100| 63 6f 20 50 69 6f 76 61 | 6e 65 6c 6c 69 0d 20 2a |co Piova|nelli. *|
|00000110| 09 41 6c 6c 20 52 69 67 | 68 74 73 20 52 65 73 65 |.All Rig|hts Rese|
|00000120| 72 76 65 64 0d 20 2a 0d | 20 2a 20 20 43 20 70 6f |rved. *.| * C po|
|00000130| 72 74 20 62 79 20 44 61 | 6e 20 43 72 65 76 69 65 |rt by Da|n Crevie|
|00000140| 72 0d 20 2a 0d 20 2a 2f | 0d 0d 2f 2a 0d 09 50 6f |r. *. */|../*..Po|
|00000150| 72 74 69 6f 6e 73 20 63 | 6f 70 79 72 69 67 68 74 |rtions c|opyright|
|00000160| 20 a9 20 31 39 39 38 2d | 31 39 39 39 20 62 79 20 | . 1998-|1999 by |
|00000170| 41 70 70 6c 65 20 43 6f | 6d 70 75 74 65 72 2c 20 |Apple Co|mputer, |
|00000180| 49 6e 63 2e 20 41 6c 6c | 20 72 69 67 68 74 73 20 |Inc. All| rights |
|00000190| 72 65 73 65 72 76 65 64 | 2e 0d 0d 09 43 68 61 6e |reserved|....Chan|
|000001a0| 67 65 20 48 69 73 74 6f | 72 79 3a 0d 09 09 31 31 |ge Histo|ry:...11|
|000001b0| 2f 31 30 2f 39 39 09 54 | 57 42 09 09 43 6c 65 61 |/10/99.T|WB..Clea|
|000001c0| 6e 20 75 70 20 74 68 65 | 20 70 72 69 76 61 74 65 |n up the| private|
|000001d0| 20 69 6e 74 65 72 66 61 | 63 65 73 2e 20 0d 09 09 | interfa|ces. ...|
|000001e0| 31 30 2f 32 39 2f 39 38 | 09 54 57 42 09 09 5a 6f |10/29/98|.TWB..Zo|
|000001f0| 6f 6d 20 73 75 70 70 6f | 72 74 2e 20 0d 2a 2f 0d |om suppo|rt. .*/.|
|00000200| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 22 57 41 53 54 |..#inclu|de "WAST|
|00000210| 45 49 6e 74 66 2e 68 22 | 0d 0d 49 4e 4c 49 4e 45 |EIntf.h"|..INLINE|
|00000220| 20 70 61 73 63 61 6c 20 | 76 6f 69 64 20 5f 57 45 | pascal |void _WE|
|00000230| 52 65 6d 6f 76 65 4c 69 | 6e 65 28 53 49 6e 74 33 |RemoveLi|ne(SInt3|
|00000240| 32 20 6c 69 6e 65 49 6e | 64 65 78 2c 20 57 45 50 |2 lineIn|dex, WEP|
|00000250| 74 72 20 70 57 45 29 0d | 7b 0d 09 2f 2f 20 72 65 |tr pWE).|{..// re|
|00000260| 6d 6f 76 65 20 74 68 65 | 20 6c 69 6e 65 0d 09 5f |move the| line.._|
|00000270| 57 45 53 70 6c 69 63 65 | 28 28 48 61 6e 64 6c 65 |WESplice|((Handle|
|00000280| 29 20 70 57 45 2d 3e 68 | 4c 69 6e 65 73 2c 20 6e |) pWE->h|Lines, n|
|00000290| 69 6c 2c 20 2d 20 73 69 | 7a 65 6f 66 28 57 45 4c |il, - si|zeof(WEL|
|000002a0| 69 6e 65 52 65 63 29 2c | 20 6c 69 6e 65 49 6e 64 |ineRec),| lineInd|
|000002b0| 65 78 20 2a 20 73 69 7a | 65 6f 66 28 57 45 4c 69 |ex * siz|eof(WELi|
|000002c0| 6e 65 52 65 63 29 29 3b | 0d 0d 09 2f 2f 20 64 65 |neRec));|...// de|
|000002d0| 63 72 65 6d 65 6e 74 20 | 6c 69 6e 65 20 63 6f 75 |crement |line cou|
|000002e0| 6e 74 0d 09 70 57 45 2d | 3e 6e 4c 69 6e 65 73 2d |nt..pWE-|>nLines-|
|000002f0| 2d 3b 0d 7d 0d 0d 70 61 | 73 63 61 6c 20 4f 53 45 |-;.}..pa|scal OSE|
|00000300| 72 72 20 5f 57 45 49 6e | 73 65 72 74 4c 69 6e 65 |rr _WEIn|sertLine|
|00000310| 28 53 49 6e 74 33 32 20 | 6c 69 6e 65 49 6e 64 65 |(SInt32 |lineInde|
|00000320| 78 2c 20 63 6f 6e 73 74 | 20 57 45 4c 69 6e 65 52 |x, const| WELineR|
|00000330| 65 63 20 2a 70 4c 69 6e | 65 2c 20 57 45 50 74 72 |ec *pLin|e, WEPtr|
|00000340| 20 70 57 45 29 0d 7b 0d | 09 2f 2f 20 69 6e 73 65 | pWE).{.|.// inse|
|00000350| 72 74 20 74 68 65 20 73 | 70 65 63 69 66 69 65 64 |rt the s|pecified|
|00000360| 20 65 6e 74 72 79 20 69 | 6e 20 74 68 65 20 6c 69 | entry i|n the li|
|00000370| 6e 65 20 61 72 72 61 79 | 0d 09 4f 53 45 72 72 20 |ne array|..OSErr |
|00000380| 65 72 72 3b 0d 0d 09 2f | 2f 20 64 6f 20 74 68 65 |err;.../|/ do the|
|00000390| 20 69 6e 73 65 72 74 69 | 6f 6e 0d 09 69 66 20 28 | inserti|on..if (|
|000003a0| 28 65 72 72 20 3d 20 5f | 57 45 53 70 6c 69 63 65 |(err = _|WESplice|
|000003b0| 28 28 48 61 6e 64 6c 65 | 29 20 70 57 45 2d 3e 68 |((Handle|) pWE->h|
|000003c0| 4c 69 6e 65 73 2c 20 70 | 4c 69 6e 65 2c 20 73 69 |Lines, p|Line, si|
|000003d0| 7a 65 6f 66 28 57 45 4c | 69 6e 65 52 65 63 29 2c |zeof(WEL|ineRec),|
|000003e0| 20 6c 69 6e 65 49 6e 64 | 65 78 20 2a 20 73 69 7a | lineInd|ex * siz|
|000003f0| 65 6f 66 28 57 45 4c 69 | 6e 65 52 65 63 29 29 29 |eof(WELi|neRec)))|
|00000400| 20 21 3d 20 6e 6f 45 72 | 72 29 0d 09 7b 0d 09 09 | != noEr|r)..{...|
|00000410| 72 65 74 75 72 6e 20 65 | 72 72 3b 0d 09 7d 0d 0d |return e|rr;..}..|
|00000420| 09 2f 2f 20 69 6e 63 72 | 65 6d 65 6e 74 20 6c 69 |.// incr|ement li|
|00000430| 6e 65 20 63 6f 75 6e 74 | 0d 09 70 57 45 2d 3e 6e |ne count|..pWE->n|
|00000440| 4c 69 6e 65 73 2b 2b 3b | 0d 09 72 65 74 75 72 6e |Lines++;|..return|
|00000450| 20 6e 6f 45 72 72 3b 0d | 7d 0d 0d 70 61 73 63 61 | noErr;.|}..pasca|
|00000460| 6c 20 76 6f 69 64 20 5f | 57 45 42 75 6d 70 4f 72 |l void _|WEBumpOr|
|00000470| 69 67 69 6e 28 53 49 6e | 74 33 32 20 6c 69 6e 65 |igin(SIn|t32 line|
|00000480| 49 6e 64 65 78 2c 20 53 | 49 6e 74 33 32 20 64 65 |Index, S|Int32 de|
|00000490| 6c 74 61 4f 72 69 67 69 | 6e 2c 20 57 45 50 74 72 |ltaOrigi|n, WEPtr|
|000004a0| 20 70 57 45 29 0d 7b 0d | 09 57 45 4c 69 6e 65 52 | pWE).{.|.WELineR|
|000004b0| 65 63 20 2a 70 4c 69 6e | 65 20 3d 20 2a 70 57 45 |ec *pLin|e = *pWE|
|000004c0| 2d 3e 68 4c 69 6e 65 73 | 20 2b 20 6c 69 6e 65 49 |->hLines| + lineI|
|000004d0| 6e 64 65 78 3b 0d 09 53 | 49 6e 74 33 32 20 6e 4c |ndex;..S|Int32 nL|
|000004e0| 69 6e 65 73 20 3d 20 70 | 57 45 2d 3e 6e 4c 69 6e |ines = p|WE->nLin|
|000004f0| 65 73 3b 0d 0d 09 2f 2f | 20 6c 6f 6f 70 20 74 68 |es;...//| loop th|
|00000500| 72 6f 75 67 68 20 74 68 | 65 20 6c 69 6e 65 20 72 |rough th|e line r|
|00000510| 75 6e 20 61 72 72 61 79 | 20 61 64 6a 75 73 74 69 |un array| adjusti|
|00000520| 6e 67 20 74 68 65 20 6c | 69 6e 65 4f 72 69 67 69 |ng the l|ineOrigi|
|00000530| 6e 20 66 69 65 6c 64 73 | 0d 09 66 6f 72 20 28 20 |n fields|..for ( |
|00000540| 3b 20 6c 69 6e 65 49 6e | 64 65 78 20 3c 3d 20 6e |; lineIn|dex <= n|
|00000550| 4c 69 6e 65 73 3b 20 6c | 69 6e 65 49 6e 64 65 78 |Lines; l|ineIndex|
|00000560| 2b 2b 20 29 0d 09 7b 0d | 09 09 70 4c 69 6e 65 2d |++ )..{.|..pLine-|
|00000570| 3e 6c 69 6e 65 4f 72 69 | 67 69 6e 20 2b 3d 20 64 |>lineOri|gin += d|
|00000580| 65 6c 74 61 4f 72 69 67 | 69 6e 3b 0d 09 09 70 4c |eltaOrig|in;...pL|
|00000590| 69 6e 65 2b 2b 3b 0d 09 | 7d 0d 7d 0d 0d 70 61 73 |ine++;..|}.}..pas|
|000005a0| 63 61 6c 20 53 49 6e 74 | 33 32 20 5f 57 45 46 69 |cal SInt|32 _WEFi|
|000005b0| 6e 64 4c 69 6e 65 42 72 | 65 61 6b 28 53 49 6e 74 |ndLineBr|eak(SInt|
|000005c0| 33 32 20 6c 69 6e 65 53 | 74 61 72 74 2c 20 57 45 |32 lineS|tart, WE|
|000005d0| 48 61 6e 64 6c 65 20 68 | 57 45 29 0d 7b 0d 09 2f |Handle h|WE).{../|
|000005e0| 2f 20 46 69 6e 64 20 77 | 68 65 72 65 20 74 6f 20 |/ Find w|here to |
|000005f0| 62 72 65 61 6b 20 74 68 | 65 20 6c 69 6e 65 20 62 |break th|e line b|
|00000600| 65 67 69 6e 6e 69 6e 67 | 20 61 74 20 6c 69 6e 65 |eginning| at line|
|00000610| 53 74 61 72 74 0d 09 2f | 2f 20 74 68 65 20 63 75 |Start../|/ the cu|
|00000620| 72 72 65 6e 74 20 67 72 | 61 70 68 69 63 73 20 70 |rrent gr|aphics p|
|00000630| 6f 72 74 20 6d 75 73 74 | 20 62 65 20 61 6c 72 65 |ort must| be alre|
|00000640| 61 64 79 20 73 65 74 20 | 75 70 20 63 6f 72 72 65 |ady set |up corre|
|00000650| 63 74 6c 79 0d 0d 09 57 | 45 50 74 72 20 70 57 45 |ctly...W|EPtr pWE|
|00000660| 20 3d 20 2a 68 57 45 3b | 09 2f 2f 20 61 73 73 75 | = *hWE;|.// assu|
|00000670| 6d 65 20 57 45 20 72 65 | 63 6f 72 64 20 69 73 20 |me WE re|cord is |
|00000680| 61 6c 72 65 61 64 79 20 | 6c 6f 63 6b 65 64 0d 09 |already |locked..|
|00000690| 50 74 72 20 70 54 65 78 | 74 3b 0d 09 53 49 6e 74 |Ptr pTex|t;..SInt|
|000006a0| 33 32 20 6f 66 66 73 65 | 74 2c 20 62 72 65 61 6b |32 offse|t, break|
|000006b0| 4f 66 66 73 65 74 3b 0d | 09 53 49 6e 74 33 32 20 |Offset;.|.SInt32 |
|000006c0| 74 65 78 74 4c 65 6e 67 | 74 68 3b 0d 09 53 49 6e |textLeng|th;..SIn|
|000006d0| 74 33 32 20 72 65 6d 61 | 69 6e 69 6e 67 4c 65 6e |t32 rema|iningLen|
|000006e0| 67 74 68 3b 0d 09 53 49 | 6e 74 33 32 20 73 65 67 |gth;..SI|nt32 seg|
|000006f0| 6d 65 6e 74 53 74 61 72 | 74 2c 20 73 65 67 6d 65 |mentStar|t, segme|
|00000700| 6e 74 45 6e 64 3b 0d 09 | 53 49 6e 74 33 32 20 72 |ntEnd;..|SInt32 r|
|00000710| 75 6e 49 6e 64 65 78 3b | 0d 09 57 45 52 75 6e 49 |unIndex;|..WERunI|
|00000720| 6e 66 6f 50 72 69 76 20 | 72 75 6e 49 6e 66 6f 3b |nfoPriv |runInfo;|
|00000730| 0d 09 46 69 78 65 64 20 | 70 69 78 65 6c 57 69 64 |..Fixed |pixelWid|
|00000740| 74 68 3b 0d 09 53 63 72 | 69 70 74 43 6f 64 65 20 |th;..Scr|iptCode |
|00000750| 73 63 72 69 70 74 2c 20 | 70 72 65 76 69 6f 75 73 |script, |previous|
|00000760| 53 63 72 69 70 74 3b 0d | 09 42 6f 6f 6c 65 61 6e |Script;.|.Boolean|
|00000770| 20 69 73 42 72 65 61 6b | 20 3d 20 66 61 6c 73 65 | isBreak| = false|
|00000780| 3b 0d 0d 09 6f 66 66 73 | 65 74 20 3d 20 6c 69 6e |;...offs|et = lin|
|00000790| 65 53 74 61 72 74 3b 0d | 09 70 54 65 78 74 20 3d |eStart;.|.pText =|
|000007a0| 20 2a 70 57 45 2d 3e 68 | 54 65 78 74 20 2b 20 6f | *pWE->h|Text + o|
|000007b0| 66 66 73 65 74 3b 0d 09 | 72 65 6d 61 69 6e 69 6e |ffset;..|remainin|
|000007c0| 67 4c 65 6e 67 74 68 20 | 3d 20 70 57 45 2d 3e 74 |gLength |= pWE->t|
|000007d0| 65 78 74 4c 65 6e 67 74 | 68 20 2d 20 6f 66 66 73 |extLengt|h - offs|
|000007e0| 65 74 3b 0d 0d 09 2f 2f | 20 66 69 6e 64 20 74 68 |et;...//| find th|
|000007f0| 65 20 73 74 79 6c 65 20 | 72 75 6e 20 69 6e 64 65 |e style |run inde|
|00000800| 78 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 20 |x corres|ponding |
|00000810| 74 6f 20 74 68 65 20 66 | 69 72 73 74 20 73 65 67 |to the f|irst seg|
|00000820| 6d 65 6e 74 20 6f 6e 20 | 74 68 69 73 20 6c 69 6e |ment on |this lin|
|00000830| 65 0d 09 72 75 6e 49 6e | 64 65 78 20 3d 20 57 45 |e..runIn|dex = WE|
|00000840| 4f 66 66 73 65 74 54 6f | 52 75 6e 28 6f 66 66 73 |OffsetTo|Run(offs|
|00000850| 65 74 2c 20 68 57 45 29 | 3b 0d 0d 09 2f 2f 20 69 |et, hWE)|;...// i|
|00000860| 6e 69 74 69 61 6c 69 7a | 65 20 70 69 78 65 6c 57 |nitializ|e pixelW|
|00000870| 69 64 74 68 20 74 6f 20 | 74 68 65 20 77 69 64 74 |idth to |the widt|
|00000880| 68 20 6f 66 20 74 68 65 | 20 64 65 73 74 69 6e 61 |h of the| destina|
|00000890| 74 69 6f 6e 20 72 65 63 | 74 61 6e 67 6c 65 2c 20 |tion rec|tangle, |
|000008a0| 61 73 20 61 20 46 69 78 | 65 64 20 71 75 61 6e 74 |as a Fix|ed quant|
|000008b0| 69 74 79 0d 09 70 69 78 | 65 6c 57 69 64 74 68 20 |ity..pix|elWidth |
|000008c0| 3d 20 42 53 4c 28 28 70 | 57 45 2d 3e 64 65 73 74 |= BSL((p|WE->dest|
|000008d0| 52 65 63 74 2e 72 69 67 | 68 74 20 2d 20 70 57 45 |Rect.rig|ht - pWE|
|000008e0| 2d 3e 64 65 73 74 52 65 | 63 74 2e 6c 65 66 74 29 |->destRe|ct.left)|
|000008f0| 2c 20 31 36 29 3b 0d 0d | 09 2f 2f 20 53 54 59 4c |, 16);..|.// STYL|
|00000900| 45 20 53 45 47 4d 45 4e | 54 20 4c 4f 4f 50 0d 09 |E SEGMEN|T LOOP..|
|00000910| 64 6f 0d 09 7b 0d 0d 09 | 09 2f 2f 20 67 65 74 20 |do..{...|.// get |
|00000920| 73 74 79 6c 65 20 72 75 | 6e 20 69 6e 66 6f 72 6d |style ru|n inform|
|00000930| 61 74 69 6f 6e 20 66 6f | 72 20 74 68 65 20 63 75 |ation fo|r the cu|
|00000940| 72 72 65 6e 74 20 73 74 | 79 6c 65 20 72 75 6e 0d |rrent st|yle run.|
|00000950| 09 09 5f 57 45 47 65 74 | 49 6e 64 53 74 79 6c 65 |.._WEGet|IndStyle|
|00000960| 28 72 75 6e 49 6e 64 65 | 78 2c 20 26 72 75 6e 49 |(runInde|x, &runI|
|00000970| 6e 66 6f 2c 20 68 57 45 | 29 3b 0d 09 09 72 75 6e |nfo, hWE|);...run|
|00000980| 49 6e 64 65 78 2b 2b 3b | 0d 0d 09 09 2f 2f 20 73 |Index++;|....// s|
|00000990| 65 74 20 74 65 78 74 20 | 61 74 74 72 69 62 75 74 |et text |attribut|
|000009a0| 65 73 20 69 6e 20 74 68 | 65 20 67 72 61 70 68 69 |es in th|e graphi|
|000009b0| 63 73 20 70 6f 72 74 0d | 09 09 54 65 78 74 46 6f |cs port.|..TextFo|
|000009c0| 6e 74 28 72 75 6e 49 6e | 66 6f 2e 72 75 6e 41 74 |nt(runIn|fo.runAt|
|000009d0| 74 72 73 2e 72 75 6e 53 | 74 79 6c 65 2e 74 73 46 |trs.runS|tyle.tsF|
|000009e0| 6f 6e 74 29 3b 0d 09 09 | 54 65 78 74 46 61 63 65 |ont);...|TextFace|
|000009f0| 28 72 75 6e 49 6e 66 6f | 2e 72 75 6e 41 74 74 72 |(runInfo|.runAttr|
|00000a00| 73 2e 72 75 6e 53 74 79 | 6c 65 2e 74 73 46 61 63 |s.runSty|le.tsFac|
|00000a10| 65 29 3b 0d 09 09 54 65 | 78 74 53 69 7a 65 28 72 |e);...Te|xtSize(r|
|00000a20| 75 6e 49 6e 66 6f 2e 72 | 75 6e 41 74 74 72 73 2e |unInfo.r|unAttrs.|
|00000a30| 72 75 6e 53 74 79 6c 65 | 2e 74 73 53 69 7a 65 29 |runStyle|.tsSize)|
|00000a40| 3b 0d 0d 09 09 2f 2f 20 | 69 66 20 77 65 27 72 65 |;....// |if we're|
|00000a50| 20 68 61 6e 64 6c 69 6e | 67 20 6d 75 6c 74 69 73 | handlin|g multis|
|00000a60| 63 72 69 70 74 20 74 65 | 78 74 2c 20 6b 65 65 70 |cript te|xt, keep|
|00000a70| 20 74 72 61 63 6b 20 6f | 66 20 73 63 72 69 70 74 | track o|f script|
|00000a80| 20 62 6f 75 6e 64 61 72 | 69 65 73 0d 09 09 69 66 | boundar|ies...if|
|00000a90| 20 28 42 54 53 54 28 70 | 57 45 2d 3e 66 6c 61 67 | (BTST(p|WE->flag|
|00000aa0| 73 2c 20 77 65 46 4e 6f | 6e 52 6f 6d 61 6e 29 29 |s, weFNo|nRoman))|
|00000ab0| 0d 09 09 7b 0d 09 09 09 | 2f 2f 20 77 68 61 74 20 |...{....|// what |
|00000ac0| 69 73 20 74 68 65 20 73 | 63 72 69 70 74 20 66 6f |is the s|cript fo|
|00000ad0| 72 20 74 68 69 73 20 73 | 65 67 6d 65 6e 74 3f 0d |r this s|egment?.|
|00000ae0| 09 09 09 73 63 72 69 70 | 74 20 3d 20 46 6f 6e 74 |...scrip|t = Font|
|00000af0| 54 6f 53 63 72 69 70 74 | 28 72 75 6e 49 6e 66 6f |ToScript|(runInfo|
|00000b00| 2e 72 75 6e 41 74 74 72 | 73 2e 72 75 6e 53 74 79 |.runAttr|s.runSty|
|00000b10| 6c 65 2e 74 73 46 6f 6e | 74 29 3b 0d 0d 09 09 09 |le.tsFon|t);.....|
|00000b20| 2f 2f 20 68 61 76 65 20 | 77 65 20 63 72 6f 73 73 |// have |we cross|
|00000b30| 65 64 20 61 20 73 63 72 | 69 70 74 20 72 75 6e 20 |ed a scr|ipt run |
|00000b40| 62 6f 75 6e 64 61 72 79 | 20 69 6e 20 74 68 65 20 |boundary| in the |
|00000b50| 6d 69 64 64 6c 65 20 6f | 66 20 61 20 6c 69 6e 65 |middle o|f a line|
|00000b60| 3f 0d 09 09 09 69 66 20 | 28 28 72 75 6e 49 6e 66 |?....if |((runInf|
|00000b70| 6f 2e 72 75 6e 53 74 61 | 72 74 20 3e 20 6f 66 66 |o.runSta|rt > off|
|00000b80| 73 65 74 29 20 26 26 20 | 28 73 63 72 69 70 74 20 |set) && |(script |
|00000b90| 21 3d 20 70 72 65 76 69 | 6f 75 73 53 63 72 69 70 |!= previ|ousScrip|
|00000ba0| 74 29 29 0d 09 09 09 7b | 0d 09 09 09 09 2f 2f 20 |t))....{|.....// |
|00000bb0| 6c 65 61 76 65 20 62 65 | 68 69 6e 64 20 74 68 65 |leave be|hind the|
|00000bc0| 20 61 6c 6c 20 70 72 65 | 76 69 6f 75 73 20 73 65 | all pre|vious se|
|00000bd0| 67 6d 65 6e 74 73 20 6f | 6e 20 74 68 69 73 20 6c |gments o|n this l|
|00000be0| 69 6e 65 0d 09 09 09 09 | 6f 66 66 73 65 74 20 3d |ine.....|offset =|
|00000bf0| 20 72 75 6e 49 6e 66 6f | 2e 72 75 6e 53 74 61 72 | runInfo|.runStar|
|00000c00| 74 3b 0d 09 09 09 09 70 | 54 65 78 74 20 3d 20 2a |t;.....p|Text = *|
|00000c10| 70 57 45 2d 3e 68 54 65 | 78 74 20 2b 20 6f 66 66 |pWE->hTe|xt + off|
|00000c20| 73 65 74 3b 0d 09 09 09 | 09 72 65 6d 61 69 6e 69 |set;....|.remaini|
|00000c30| 6e 67 4c 65 6e 67 74 68 | 20 3d 20 70 57 45 2d 3e |ngLength| = pWE->|
|00000c40| 74 65 78 74 4c 65 6e 67 | 74 68 20 2d 20 6f 66 66 |textLeng|th - off|
|00000c50| 73 65 74 3b 0d 09 09 09 | 7d 0d 09 09 09 70 72 65 |set;....|}....pre|
|00000c60| 76 69 6f 75 73 53 63 72 | 69 70 74 20 3d 20 73 63 |viousScr|ipt = sc|
|00000c70| 72 69 70 74 3b 0d 09 09 | 7d 20 2f 2f 20 69 66 20 |ript;...|} // if |
|00000c80| 6e 6f 6e 2d 52 6f 6d 61 | 6e 0d 0d 09 09 2f 2f 20 |non-Roma|n....// |
|00000c90| 77 65 27 6c 6c 20 70 61 | 73 73 20 74 65 78 74 4c |we'll pa|ss textL|
|00000ca0| 65 6e 67 74 68 20 61 73 | 20 74 68 65 20 73 65 63 |ength as| the sec|
|00000cb0| 6f 6e 64 20 70 61 72 61 | 6d 65 74 65 72 20 74 6f |ond para|meter to|
|00000cc0| 20 74 68 65 20 6c 69 6e | 65 20 62 72 65 61 6b 20 | the lin|e break |
|00000cd0| 68 6f 6f 6b 0d 09 09 2f | 2f 20 61 6c 74 68 6f 75 |hook.../|/ althou|
|00000ce0| 67 68 20 74 68 69 73 20 | 70 61 72 61 6d 65 74 65 |gh this |paramete|
|00000cf0| 72 20 69 73 20 64 65 63 | 6c 61 72 65 64 20 61 73 |r is dec|lared as|
|00000d00| 20 61 20 6c 6f 6e 67 2c | 20 53 74 79 6c 65 64 4c | a long,| StyledL|
|00000d10| 69 6e 65 42 72 65 61 6b | 20 75 73 65 73 20 6f 6e |ineBreak| uses on|
|00000d20| 6c 79 0d 09 09 2f 2f 20 | 74 68 65 20 6c 6f 77 20 |ly...// |the low |
|00000d30| 77 6f 72 64 2c 20 73 6f | 20 6d 61 6b 65 20 73 75 |word, so| make su|
|00000d40| 72 65 20 69 74 20 64 6f | 65 73 6e 27 74 20 74 72 |re it do|esn't tr|
|00000d50| 65 73 70 61 73 73 20 74 | 68 65 20 33 32 2c 37 36 |espass t|he 32,76|
|00000d60| 37 20 62 79 74 65 20 74 | 68 72 65 73 68 6f 6c 64 |7 byte t|hreshold|
|00000d70| 21 0d 09 09 74 65 78 74 | 4c 65 6e 67 74 68 20 3d |!...text|Length =|
|00000d80| 20 5f 57 45 50 69 6e 49 | 6e 52 61 6e 67 65 28 72 | _WEPinI|nRange(r|
|00000d90| 65 6d 61 69 6e 69 6e 67 | 4c 65 6e 67 74 68 2c 20 |emaining|Length, |
|00000da0| 30 2c 20 53 48 52 54 5f | 4d 41 58 29 3b 0d 0d 09 |0, SHRT_|MAX);...|
|00000db0| 09 2f 2f 20 63 61 6c 63 | 75 6c 61 74 65 20 73 65 |.// calc|ulate se|
|00000dc0| 67 6d 65 6e 74 53 74 61 | 72 74 20 61 6e 64 20 73 |gmentSta|rt and s|
|00000dd0| 65 67 6d 65 6e 74 45 6e | 64 20 72 65 6c 61 74 69 |egmentEn|d relati|
|00000de0| 76 65 20 74 6f 20 6f 66 | 66 73 65 74 0d 09 09 73 |ve to of|fset...s|
|00000df0| 65 67 6d 65 6e 74 53 74 | 61 72 74 20 3d 20 5f 57 |egmentSt|art = _W|
|00000e00| 45 50 69 6e 49 6e 52 61 | 6e 67 65 28 72 75 6e 49 |EPinInRa|nge(runI|
|00000e10| 6e 66 6f 2e 72 75 6e 53 | 74 61 72 74 20 2d 20 6f |nfo.runS|tart - o|
|00000e20| 66 66 73 65 74 2c 20 30 | 2c 20 74 65 78 74 4c 65 |ffset, 0|, textLe|
|00000e30| 6e 67 74 68 29 3b 0d 09 | 09 73 65 67 6d 65 6e 74 |ngth);..|.segment|
|00000e40| 45 6e 64 20 3d 20 5f 57 | 45 50 69 6e 49 6e 52 61 |End = _W|EPinInRa|
|00000e50| 6e 67 65 28 72 75 6e 49 | 6e 66 6f 2e 72 75 6e 45 |nge(runI|nfo.runE|
|00000e60| 6e 64 20 2d 20 6f 66 66 | 73 65 74 2c 20 30 2c 20 |nd - off|set, 0, |
|00000e70| 74 65 78 74 4c 65 6e 67 | 74 68 29 3b 0d 0d 09 09 |textLeng|th);....|
|00000e80| 2f 2f 20 73 65 74 20 62 | 72 65 61 6b 4f 66 66 73 |// set b|reakOffs|
|00000e90| 65 74 20 74 6f 20 61 20 | 6e 6f 6e 2d 7a 65 72 6f |et to a |non-zero|
|00000ea0| 20 76 61 6c 75 65 20 66 | 6f 72 20 74 68 65 20 66 | value f|or the f|
|00000eb0| 69 72 73 74 20 73 63 72 | 69 70 74 20 72 75 6e 20 |irst scr|ipt run |
|00000ec0| 6f 6e 20 74 68 65 20 6c | 69 6e 65 2c 0d 09 09 2f |on the l|ine,.../|
|00000ed0| 2f 20 73 65 74 20 69 74 | 20 74 6f 20 7a 65 72 6f |/ set it| to zero|
|00000ee0| 20 66 6f 72 20 61 6c 6c | 20 73 75 62 73 65 71 75 | for all| subsequ|
|00000ef0| 65 6e 74 20 73 63 72 69 | 70 74 20 72 75 6e 73 0d |ent scri|pt runs.|
|00000f00| 09 09 62 72 65 61 6b 4f | 66 66 73 65 74 20 3d 20 |..breakO|ffset = |
|00000f10| 28 6f 66 66 73 65 74 20 | 3d 3d 20 6c 69 6e 65 53 |(offset |== lineS|
|00000f20| 74 61 72 74 29 3b 0d 0d | 23 69 66 20 57 41 53 54 |tart);..|#if WAST|
|00000f30| 45 5f 4f 42 4a 45 43 54 | 53 0d 09 09 69 66 20 28 |E_OBJECT|S...if (|
|00000f40| 72 75 6e 49 6e 66 6f 2e | 72 75 6e 41 74 74 72 73 |runInfo.|runAttrs|
|00000f50| 2e 72 75 6e 53 74 79 6c | 65 2e 74 73 4f 62 6a 65 |.runStyl|e.tsObje|
|00000f60| 63 74 20 21 3d 20 6e 69 | 6c 29 0d 09 09 7b 0d 09 |ct != ni|l)...{..|
|00000f70| 09 09 2f 2f 20 45 4d 42 | 45 44 44 45 44 20 4f 42 |..// EMB|EDDED OB|
|00000f80| 4a 45 43 54 0d 09 09 09 | 2f 2f 20 73 75 62 74 72 |JECT....|// subtr|
|00000f90| 61 63 74 20 6f 62 6a 65 | 63 74 20 77 69 64 74 68 |act obje|ct width|
|00000fa0| 20 66 72 6f 6d 20 70 69 | 78 65 6c 57 69 64 74 68 | from pi|xelWidth|
|00000fb0| 0d 09 09 09 70 69 78 65 | 6c 57 69 64 74 68 20 2d |....pixe|lWidth -|
|00000fc0| 3d 20 42 53 4c 28 28 2a | 72 75 6e 49 6e 66 6f 2e |= BSL((*|runInfo.|
|00000fd0| 72 75 6e 41 74 74 72 73 | 2e 72 75 6e 53 74 79 6c |runAttrs|.runStyl|
|00000fe0| 65 2e 74 73 4f 62 6a 65 | 63 74 29 2d 3e 6f 62 6a |e.tsObje|ct)->obj|
|00000ff0| 65 63 74 53 69 7a 65 2e | 68 2c 20 31 36 29 3b 0d |ectSize.|h, 16);.|
|00001000| 0d 09 09 09 2f 2f 20 73 | 74 6f 70 20 6c 6f 6f 70 |....// s|top loop|
|00001010| 69 6e 67 20 69 66 20 70 | 69 78 65 6c 57 69 64 74 |ing if p|ixelWidt|
|00001020| 68 20 68 61 73 20 67 6f | 6e 65 20 6e 65 67 61 74 |h has go|ne negat|
|00001030| 69 76 65 0d 09 09 09 69 | 73 42 72 65 61 6b 20 3d |ive....i|sBreak =|
|00001040| 20 28 70 69 78 65 6c 57 | 69 64 74 68 20 3c 20 30 | (pixelW|idth < 0|
|00001050| 29 3b 0d 09 09 09 62 72 | 65 61 6b 4f 66 66 73 65 |);....br|eakOffse|
|00001060| 74 20 3d 20 69 73 42 72 | 65 61 6b 20 3f 20 73 65 |t = isBr|eak ? se|
|00001070| 67 6d 65 6e 74 53 74 61 | 72 74 20 3a 20 73 65 67 |gmentSta|rt : seg|
|00001080| 6d 65 6e 74 45 6e 64 3b | 0d 09 09 7d 0d 09 09 65 |mentEnd;|...}...e|
|00001090| 6c 73 65 0d 23 65 6e 64 | 69 66 0d 09 09 7b 0d 09 |lse.#end|if...{..|
|000010a0| 09 09 2f 2f 20 52 45 47 | 55 4c 41 52 20 54 45 58 |..// REG|ULAR TEX|
|000010b0| 54 0d 09 09 09 69 73 42 | 72 65 61 6b 20 3d 20 28 |T....isB|reak = (|
|000010c0| 43 61 6c 6c 57 45 4c 69 | 6e 65 42 72 65 61 6b 50 |CallWELi|neBreakP|
|000010d0| 72 6f 63 28 70 54 65 78 | 74 2c 20 74 65 78 74 4c |roc(pTex|t, textL|
|000010e0| 65 6e 67 74 68 2c 20 73 | 65 67 6d 65 6e 74 53 74 |ength, s|egmentSt|
|000010f0| 61 72 74 2c 20 73 65 67 | 6d 65 6e 74 45 6e 64 2c |art, seg|mentEnd,|
|00001100| 0d 09 09 09 09 26 70 69 | 78 65 6c 57 69 64 74 68 |.....&pi|xelWidth|
|00001110| 2c 20 26 62 72 65 61 6b | 4f 66 66 73 65 74 2c 20 |, &break|Offset, |
|00001120| 68 57 45 2c 20 70 57 45 | 2d 3e 6c 69 6e 65 42 72 |hWE, pWE|->lineBr|
|00001130| 65 61 6b 48 6f 6f 6b 29 | 20 21 3d 20 73 6d 42 72 |eakHook)| != smBr|
|00001140| 65 61 6b 4f 76 65 72 66 | 6c 6f 77 29 3b 0d 09 09 |eakOverf|low);...|
|00001150| 7d 0d 0d 09 09 2f 2f 20 | 62 72 65 61 6b 20 74 68 |}....// |break th|
|00001160| 65 20 6c 69 6e 65 20 61 | 6e 79 77 61 79 20 77 68 |e line a|nyway wh|
|00001170| 65 6e 20 77 65 20 72 65 | 61 63 68 20 74 68 65 20 |en we re|ach the |
|00001180| 65 6e 64 20 6f 66 20 74 | 68 65 20 74 65 78 74 0d |end of t|he text.|
|00001190| 09 09 69 66 20 28 28 73 | 65 67 6d 65 6e 74 45 6e |..if ((s|egmentEn|
|000011a0| 64 20 3e 3d 20 72 65 6d | 61 69 6e 69 6e 67 4c 65 |d >= rem|ainingLe|
|000011b0| 6e 67 74 68 29 20 7c 7c | 20 28 72 75 6e 49 6e 64 |ngth) ||| (runInd|
|000011c0| 65 78 20 3e 3d 20 70 57 | 45 2d 3e 6e 52 75 6e 73 |ex >= pW|E->nRuns|
|000011d0| 29 29 0d 09 09 7b 0d 09 | 09 09 69 73 42 72 65 61 |))...{..|..isBrea|
|000011e0| 6b 20 3d 20 74 72 75 65 | 3b 0d 09 09 7d 0d 09 7d |k = true|;...}..}|
|000011f0| 20 77 68 69 6c 65 20 28 | 21 69 73 42 72 65 61 6b | while (|!isBreak|
|00001200| 29 3b 0d 0d 09 2f 2f 20 | 72 65 74 75 72 6e 20 74 |);...// |return t|
|00001210| 68 65 20 6f 66 66 73 65 | 74 20 66 72 6f 6d 20 6c |he offse|t from l|
|00001220| 69 6e 65 53 74 61 72 74 | 20 74 6f 20 74 68 65 20 |ineStart| to the |
|00001230| 62 72 65 61 6b 20 70 6f | 69 6e 74 0d 09 72 65 74 |break po|int..ret|
|00001240| 75 72 6e 20 28 6f 66 66 | 73 65 74 20 2d 20 6c 69 |urn (off|set - li|
|00001250| 6e 65 53 74 61 72 74 29 | 20 2b 20 62 72 65 61 6b |neStart)| + break|
|00001260| 4f 66 66 73 65 74 3b 0d | 7d 0d 0d 70 61 73 63 61 |Offset;.|}..pasca|
|00001270| 6c 20 76 6f 69 64 20 5f | 57 45 43 61 6c 63 48 65 |l void _|WECalcHe|
|00001280| 69 67 68 74 73 28 53 49 | 6e 74 33 32 20 72 61 6e |ights(SI|nt32 ran|
|00001290| 67 65 53 74 61 72 74 2c | 20 53 49 6e 74 33 32 20 |geStart,| SInt32 |
|000012a0| 72 61 6e 67 65 45 6e 64 | 2c 20 53 49 6e 74 31 36 |rangeEnd|, SInt16|
|000012b0| 20 2a 6c 69 6e 65 41 73 | 63 65 6e 74 2c 20 53 49 | *lineAs|cent, SI|
|000012c0| 6e 74 31 36 20 2a 6c 69 | 6e 65 44 65 73 63 65 6e |nt16 *li|neDescen|
|000012d0| 74 2c 0d 09 09 57 45 48 | 61 6e 64 6c 65 20 68 57 |t,...WEH|andle hW|
|000012e0| 45 29 0d 7b 0d 09 2f 2f | 20 46 69 6e 64 20 74 68 |E).{..//| Find th|
|000012f0| 65 20 6d 61 78 69 6d 75 | 6d 20 61 73 63 65 6e 74 |e maximu|m ascent|
|00001300| 20 61 6e 64 20 64 65 73 | 63 65 6e 74 20 76 61 6c | and des|cent val|
|00001310| 75 65 73 20 62 65 74 77 | 65 65 6e 20 72 61 6e 67 |ues betw|een rang|
|00001320| 65 53 74 61 72 74 20 61 | 6e 64 20 72 61 6e 67 65 |eStart a|nd range|
|00001330| 45 6e 64 0d 09 2f 2f 20 | 74 68 65 20 57 45 20 72 |End..// |the WE r|
|00001340| 65 63 6f 72 64 20 6d 75 | 73 74 20 62 65 20 61 6c |ecord mu|st be al|
|00001350| 72 65 61 64 79 20 6c 6f | 63 6b 65 64 0d 09 2f 2f |ready lo|cked..//|
|00001360| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 67 72 61 | the cur|rent gra|
|00001370| 70 68 69 63 73 20 70 6f | 72 74 20 6d 75 73 74 20 |phics po|rt must |
|00001380| 62 65 20 61 6c 72 65 61 | 64 79 20 73 65 74 20 75 |be alrea|dy set u|
|00001390| 70 20 63 6f 72 72 65 63 | 74 6c 79 0d 0d 09 53 49 |p correc|tly...SI|
|000013a0| 6e 74 33 32 20 72 75 6e | 49 6e 64 65 78 3b 0d 09 |nt32 run|Index;..|
|000013b0| 57 45 52 75 6e 49 6e 66 | 6f 50 72 69 76 20 72 75 |WERunInf|oPriv ru|
|000013c0| 6e 49 6e 66 6f 3b 0d 09 | 53 49 6e 74 31 36 20 72 |nInfo;..|SInt16 r|
|000013d0| 75 6e 41 73 63 65 6e 74 | 2c 20 72 75 6e 44 65 73 |unAscent|, runDes|
|000013e0| 63 65 6e 74 3b 0d 0d 09 | 2a 6c 69 6e 65 41 73 63 |cent;...|*lineAsc|
|000013f0| 65 6e 74 20 3d 20 31 3b | 0d 09 2a 6c 69 6e 65 44 |ent = 1;|..*lineD|
|00001400| 65 73 63 65 6e 74 20 3d | 20 30 3b 0d 0d 09 2f 2f |escent =| 0;...//|
|00001410| 20 66 69 6e 64 20 74 68 | 65 20 73 74 79 6c 65 20 | find th|e style |
|00001420| 72 75 6e 20 69 6e 64 65 | 78 20 63 6f 72 72 65 73 |run inde|x corres|
|00001430| 70 6f 6e 64 69 6e 67 20 | 74 6f 20 74 68 65 20 66 |ponding |to the f|
|00001440| 69 72 73 74 20 73 65 67 | 6d 65 6e 74 20 6f 6e 20 |irst seg|ment on |
|00001450| 74 68 69 73 20 6c 69 6e | 65 0d 09 72 75 6e 49 6e |this lin|e..runIn|
|00001460| 64 65 78 20 3d 20 57 45 | 4f 66 66 73 65 74 54 6f |dex = WE|OffsetTo|
|00001470| 52 75 6e 28 72 61 6e 67 | 65 53 74 61 72 74 2c 20 |Run(rang|eStart, |
|00001480| 68 57 45 29 3b 0d 0d 09 | 2f 2f 20 53 54 59 4c 45 |hWE);...|// STYLE|
|00001490| 20 53 45 47 4d 45 4e 54 | 20 4c 4f 4f 50 0d 09 64 | SEGMENT| LOOP..d|
|000014a0| 6f 0d 09 7b 0d 09 09 2f | 2f 20 67 65 74 20 73 74 |o..{.../|/ get st|
|000014b0| 79 6c 65 20 72 75 6e 20 | 69 6e 66 6f 72 6d 61 74 |yle run |informat|
|000014c0| 69 6f 6e 20 66 6f 72 20 | 74 68 65 20 63 75 72 72 |ion for |the curr|
|000014d0| 65 6e 74 20 73 74 79 6c | 65 20 72 75 6e 0d 09 09 |ent styl|e run...|
|000014e0| 5f 57 45 47 65 74 49 6e | 64 53 74 79 6c 65 28 72 |_WEGetIn|dStyle(r|
|000014f0| 75 6e 49 6e 64 65 78 2c | 20 26 72 75 6e 49 6e 66 |unIndex,| &runInf|
|00001500| 6f 2c 20 68 57 45 29 3b | 0d 09 09 72 75 6e 49 6e |o, hWE);|...runIn|
|00001510| 64 65 78 2b 2b 3b 0d 0d | 09 09 2f 2f 20 63 61 6c |dex++;..|..// cal|
|00001520| 63 75 6c 61 74 65 20 61 | 73 63 65 6e 74 20 61 6e |culate a|scent an|
|00001530| 64 20 64 65 73 63 65 6e | 74 20 28 61 63 74 75 61 |d descen|t (actua|
|00001540| 6c 6c 79 2c 20 64 65 73 | 63 65 6e 74 20 2b 20 6c |lly, des|cent + l|
|00001550| 65 61 64 69 6e 67 29 20 | 76 61 6c 75 65 73 20 66 |eading) |values f|
|00001560| 6f 72 20 74 68 69 73 20 | 73 74 79 6c 65 20 72 75 |or this |style ru|
|00001570| 6e 0d 0d 23 69 66 20 57 | 41 53 54 45 5f 4f 42 4a |n..#if W|ASTE_OBJ|
|00001580| 45 43 54 53 0d 09 09 69 | 66 20 28 72 75 6e 49 6e |ECTS...i|f (runIn|
|00001590| 66 6f 2e 72 75 6e 41 74 | 74 72 73 2e 72 75 6e 53 |fo.runAt|trs.runS|
|000015a0| 74 79 6c 65 2e 74 73 4f | 62 6a 65 63 74 20 21 3d |tyle.tsO|bject !=|
|000015b0| 20 6e 69 6c 29 0d 09 09 | 7b 0d 09 09 09 2f 2f 20 | nil)...|{....// |
|000015c0| 45 4d 42 45 44 44 45 44 | 20 4f 42 4a 45 43 54 0d |EMBEDDED| OBJECT.|
|000015d0| 09 09 09 72 75 6e 41 73 | 63 65 6e 74 20 3d 20 28 |...runAs|cent = (|
|000015e0| 2a 72 75 6e 49 6e 66 6f | 2e 72 75 6e 41 74 74 72 |*runInfo|.runAttr|
|000015f0| 73 2e 72 75 6e 53 74 79 | 6c 65 2e 74 73 4f 62 6a |s.runSty|le.tsObj|
|00001600| 65 63 74 29 2d 3e 6f 62 | 6a 65 63 74 53 69 7a 65 |ect)->ob|jectSize|
|00001610| 2e 76 3b 0d 09 09 09 72 | 75 6e 44 65 73 63 65 6e |.v;....r|unDescen|
|00001620| 74 20 3d 20 30 3b 0d 09 | 09 7d 0d 09 09 65 6c 73 |t = 0;..|.}...els|
|00001630| 65 0d 23 65 6e 64 69 66 | 0d 09 09 7b 0d 09 09 09 |e.#endif|...{....|
|00001640| 2f 2f 20 52 45 47 55 4c | 41 52 20 54 45 58 54 0d |// REGUL|AR TEXT.|
|00001650| 09 09 09 72 75 6e 41 73 | 63 65 6e 74 20 3d 20 72 |...runAs|cent = r|
|00001660| 75 6e 49 6e 66 6f 2e 72 | 75 6e 41 74 74 72 73 2e |unInfo.r|unAttrs.|
|00001670| 72 75 6e 41 73 63 65 6e | 74 3b 0d 09 09 09 72 75 |runAscen|t;....ru|
|00001680| 6e 44 65 73 63 65 6e 74 | 20 3d 20 72 75 6e 49 6e |nDescent| = runIn|
|00001690| 66 6f 2e 72 75 6e 41 74 | 74 72 73 2e 72 75 6e 48 |fo.runAt|trs.runH|
|000016a0| 65 69 67 68 74 20 2d 20 | 72 75 6e 41 73 63 65 6e |eight - |runAscen|
|000016b0| 74 3b 0d 09 09 7d 0d 0d | 09 09 2f 2f 20 73 61 76 |t;...}..|..// sav|
|000016c0| 65 20 74 68 65 20 6d 61 | 78 69 6d 75 6d 20 76 61 |e the ma|ximum va|
|000016d0| 6c 75 65 73 20 69 6e 20 | 6c 69 6e 65 41 73 63 65 |lues in |lineAsce|
|000016e0| 6e 74 20 61 6e 64 20 6c | 69 6e 65 44 65 73 63 65 |nt and l|ineDesce|
|000016f0| 6e 74 0d 09 09 69 66 20 | 28 72 75 6e 41 73 63 65 |nt...if |(runAsce|
|00001700| 6e 74 20 3e 20 2a 6c 69 | 6e 65 41 73 63 65 6e 74 |nt > *li|neAscent|
|00001710| 29 0d 09 09 7b 0d 09 09 | 09 2a 6c 69 6e 65 41 73 |)...{...|.*lineAs|
|00001720| 63 65 6e 74 20 3d 20 72 | 75 6e 41 73 63 65 6e 74 |cent = r|unAscent|
|00001730| 3b 0d 09 09 7d 0d 0d 09 | 09 69 66 20 28 72 75 6e |;...}...|.if (run|
|00001740| 44 65 73 63 65 6e 74 20 | 3e 20 2a 6c 69 6e 65 44 |Descent |> *lineD|
|00001750| 65 73 63 65 6e 74 29 0d | 09 09 7b 0d 09 09 09 2a |escent).|..{....*|
|00001760| 6c 69 6e 65 44 65 73 63 | 65 6e 74 20 3d 20 72 75 |lineDesc|ent = ru|
|00001770| 6e 44 65 73 63 65 6e 74 | 3b 0d 09 09 7d 0d 0d 09 |nDescent|;...}...|
|00001780| 09 2f 2f 20 6b 65 65 70 | 20 6c 6f 6f 70 69 6e 67 |.// keep| looping|
|00001790| 20 75 6e 74 69 6c 20 77 | 65 20 72 65 61 63 68 20 | until w|e reach |
|000017a0| 72 61 6e 67 65 45 6e 64 | 0d 09 7d 20 77 68 69 6c |rangeEnd|..} whil|
|000017b0| 65 20 28 72 75 6e 49 6e | 66 6f 2e 72 75 6e 45 6e |e (runIn|fo.runEn|
|000017c0| 64 20 3c 20 72 61 6e 67 | 65 45 6e 64 29 3b 0d 7d |d < rang|eEnd);.}|
|000017d0| 0d 0d 70 61 73 63 61 6c | 20 4f 53 45 72 72 20 5f |..pascal| OSErr _|
|000017e0| 57 45 52 65 63 61 6c 42 | 72 65 61 6b 73 28 53 49 |WERecalB|reaks(SI|
|000017f0| 6e 74 33 32 20 2a 73 74 | 61 72 74 4c 69 6e 65 2c |nt32 *st|artLine,|
|00001800| 20 53 49 6e 74 33 32 20 | 2a 65 6e 64 4c 69 6e 65 | SInt32 |*endLine|
|00001810| 2c 20 57 45 48 61 6e 64 | 6c 65 20 68 57 45 29 0d |, WEHand|le hWE).|
|00001820| 7b 0d 09 2f 2f 20 52 65 | 63 61 6c 63 75 6c 61 74 |{..// Re|calculat|
|00001830| 65 73 20 6c 69 6e 65 20 | 62 72 65 61 6b 73 2c 20 |es line |breaks, |
|00001840| 6c 69 6e 65 20 68 65 69 | 67 68 74 73 20 61 6e 64 |line hei|ghts and|
|00001850| 20 61 73 63 65 6e 74 73 | 20 66 6f 72 20 61 6c 6c | ascents| for all|
|00001860| 20 74 68 65 20 74 65 78 | 74 20 6f 72 20 66 6f 72 | the tex|t or for|
|00001870| 20 61 20 70 6f 72 74 69 | 6f 6e 20 6f 66 20 69 74 | a porti|on of it|
|00001880| 2e 0d 09 2f 2f 20 4f 6e | 20 65 6e 74 72 79 2c 20 |...// On| entry, |
|00001890| 73 74 61 72 74 4c 69 6e | 65 20 61 6e 64 20 65 6e |startLin|e and en|
|000018a0| 64 4c 69 6e 65 20 64 65 | 66 69 6e 65 20 61 20 72 |dLine de|fine a r|
|000018b0| 61 6e 67 65 20 6f 66 20 | 6c 69 6e 65 73 20 74 6f |ange of |lines to|
|000018c0| 20 72 65 63 61 6c 63 75 | 6c 61 74 65 2e 0d 09 2f | recalcu|late.../|
|000018d0| 2f 20 4f 6e 20 65 78 69 | 74 2c 20 73 74 61 72 74 |/ On exi|t, start|
|000018e0| 4c 69 6e 65 20 74 6f 20 | 65 6e 64 4c 69 6e 65 20 |Line to |endLine |
|000018f0| 64 65 66 69 6e 65 73 20 | 74 68 65 20 72 61 6e 67 |defines |the rang|
|00001900| 65 20 6f 66 20 6c 69 6e | 65 73 20 61 63 74 75 61 |e of lin|es actua|
|00001910| 6c 6c 79 20 72 65 63 61 | 6c 63 75 6c 61 74 65 64 |lly reca|lculated|
|00001920| 0d 09 2f 2f 20 74 68 65 | 20 57 45 20 72 65 63 6f |..// the| WE reco|
|00001930| 72 64 20 6d 75 73 74 20 | 61 6c 72 65 61 64 79 20 |rd must |already |
|00001940| 62 65 20 6c 6f 63 6b 65 | 64 0d 0d 09 57 45 50 74 |be locke|d...WEPt|
|00001950| 72 20 70 57 45 20 3d 20 | 2a 68 57 45 3b 0d 09 57 |r pWE = |*hWE;..W|
|00001960| 45 4c 69 6e 65 52 65 63 | 20 2a 70 4c 69 6e 65 3b |ELineRec| *pLine;|
|00001970| 0d 09 57 45 4c 69 6e 65 | 52 65 63 20 6c 69 6e 65 |..WELine|Rec line|
|00001980| 49 6e 66 6f 2c 20 6f 6c | 64 4c 69 6e 65 49 6e 66 |Info, ol|dLineInf|
|00001990| 6f 3b 0d 09 53 49 6e 74 | 33 32 20 6c 69 6e 65 49 |o;..SInt|32 lineI|
|000019a0| 6e 64 65 78 3b 0d 09 53 | 49 6e 74 33 32 20 72 65 |ndex;..S|Int32 re|
|000019b0| 63 61 6c 54 68 72 65 73 | 68 6f 6c 64 3b 0d 09 53 |calThres|hold;..S|
|000019c0| 49 6e 74 33 32 20 6c 69 | 6e 65 4f 66 66 73 65 74 |Int32 li|neOffset|
|000019d0| 3b 0d 09 53 49 6e 74 31 | 36 20 6c 69 6e 65 41 73 |;..SInt1|6 lineAs|
|000019e0| 63 65 6e 74 2c 20 6c 69 | 6e 65 44 65 73 63 65 6e |cent, li|neDescen|
|000019f0| 74 3b 0d 09 53 49 6e 74 | 33 32 20 74 65 78 74 48 |t;..SInt|32 textH|
|00001a00| 65 69 67 68 74 3b 0d 09 | 42 6f 6f 6c 65 61 6e 20 |eight;..|Boolean |
|00001a10| 73 61 76 65 54 65 78 74 | 4c 6f 63 6b 3b 0d 09 51 |saveText|Lock;..Q|
|00001a20| 44 45 6e 76 69 72 6f 6e | 6d 65 6e 74 20 73 61 76 |DEnviron|ment sav|
|00001a30| 65 45 6e 76 69 72 6f 6e | 6d 65 6e 74 3b 0d 09 4f |eEnviron|ment;..O|
|00001a40| 53 45 72 72 20 65 72 72 | 20 3d 20 6e 6f 45 72 72 |SErr err| = noErr|
|00001a50| 3b 0d 0d 09 2f 2f 20 6c | 6f 63 6b 20 74 68 65 20 |;...// l|ock the |
|00001a60| 74 65 78 74 0d 09 73 61 | 76 65 54 65 78 74 4c 6f |text..sa|veTextLo|
|00001a70| 63 6b 20 3d 20 5f 57 45 | 53 65 74 48 61 6e 64 6c |ck = _WE|SetHandl|
|00001a80| 65 4c 6f 63 6b 28 70 57 | 45 2d 3e 68 54 65 78 74 |eLock(pW|E->hText|
|00001a90| 2c 20 74 72 75 65 29 3b | 0d 0d 09 2f 2f 20 66 69 |, true);|...// fi|
|00001aa0| 6e 64 20 74 68 65 20 63 | 68 61 72 61 63 74 65 72 |nd the c|haracter|
|00001ab0| 20 6f 66 66 73 65 74 20 | 74 68 61 74 20 6d 75 73 | offset |that mus|
|00001ac0| 74 20 62 65 20 6e 65 63 | 65 73 73 61 72 69 6c 79 |t be nec|essarily|
|00001ad0| 20 72 65 61 63 68 65 64 | 20 62 65 66 6f 72 65 20 | reached| before |
|00001ae0| 77 65 20 63 61 6e 0d 09 | 2f 2f 20 65 76 65 6e 20 |we can..|// even |
|00001af0| 63 6f 6e 73 69 64 65 72 | 20 74 68 65 20 70 6f 73 |consider| the pos|
|00001b00| 73 69 62 69 6c 69 74 79 | 20 6f 66 20 73 74 6f 70 |sibility| of stop|
|00001b10| 70 69 6e 67 20 74 68 65 | 20 72 65 63 61 6c 63 75 |ping the| recalcu|
|00001b20| 6c 61 74 69 6f 6e 20 70 | 72 6f 63 65 73 73 0d 09 |lation p|rocess..|
|00001b30| 2f 2f 20 74 68 69 73 20 | 6f 66 66 73 65 74 2c 20 |// this |offset, |
|00001b40| 72 65 63 61 6c 54 68 72 | 65 73 68 6f 6c 64 2c 20 |recalThr|eshold, |
|00001b50| 69 73 20 74 68 65 20 6c | 61 73 74 20 63 68 61 72 |is the l|ast char|
|00001b60| 61 63 74 65 72 20 6f 6e | 20 65 6e 64 4c 69 6e 65 |acter on| endLine|
|00001b70| 20 5f 62 65 66 6f 72 65 | 5f 20 72 65 63 61 6c 63 | _before|_ recalc|
|00001b80| 75 6c 61 74 69 6f 6e 0d | 09 6c 69 6e 65 49 6e 64 |ulation.|.lineInd|
|00001b90| 65 78 20 3d 20 5f 57 45 | 50 69 6e 49 6e 52 61 6e |ex = _WE|PinInRan|
|00001ba0| 67 65 28 2a 65 6e 64 4c | 69 6e 65 2c 20 30 2c 20 |ge(*endL|ine, 0, |
|00001bb0| 70 57 45 2d 3e 6e 4c 69 | 6e 65 73 20 2d 20 31 29 |pWE->nLi|nes - 1)|
|00001bc0| 3b 0d 09 72 65 63 61 6c | 54 68 72 65 73 68 6f 6c |;..recal|Threshol|
|00001bd0| 64 20 3d 20 28 2a 70 57 | 45 2d 3e 68 4c 69 6e 65 |d = (*pW|E->hLine|
|00001be0| 73 29 5b 6c 69 6e 65 49 | 6e 64 65 78 20 2b 20 31 |s)[lineI|ndex + 1|
|00001bf0| 5d 2e 6c 69 6e 65 53 74 | 61 72 74 3b 0d 0d 09 2f |].lineSt|art;.../|
|00001c00| 2f 20 77 65 20 73 74 61 | 72 74 20 72 65 63 61 6c |/ we sta|rt recal|
|00001c10| 63 75 6c 61 74 69 6e 67 | 20 6c 69 6e 65 20 62 72 |culating| line br|
|00001c20| 65 61 6b 73 20 66 72 6f | 6d 20 74 68 65 20 6c 69 |eaks fro|m the li|
|00001c30| 6e 65 20 61 63 74 75 61 | 6c 6c 79 20 5f 70 72 65 |ne actua|lly _pre|
|00001c40| 63 65 64 69 6e 67 5f 20 | 73 74 61 72 74 4c 69 6e |ceding_ |startLin|
|00001c50| 65 2c 0d 09 2f 2f 20 73 | 69 6e 63 65 20 65 64 69 |e,..// s|ince edi|
|00001c60| 74 69 6e 67 20 73 74 61 | 72 74 4c 69 6e 65 20 6d |ting sta|rtLine m|
|00001c70| 61 79 20 63 61 75 73 65 | 20 70 61 72 74 20 6f 66 |ay cause| part of|
|00001c80| 20 69 74 73 20 74 65 78 | 74 20 74 6f 20 66 69 74 | its tex|t to fit|
|00001c90| 20 6f 6e 20 74 68 65 20 | 70 72 65 63 65 64 69 6e | on the |precedin|
|00001ca0| 67 20 6c 69 6e 65 0d 09 | 6c 69 6e 65 49 6e 64 65 |g line..|lineInde|
|00001cb0| 78 20 3d 20 5f 57 45 50 | 69 6e 49 6e 52 61 6e 67 |x = _WEP|inInRang|
|00001cc0| 65 28 2a 73 74 61 72 74 | 4c 69 6e 65 20 2d 20 31 |e(*start|Line - 1|
|00001cd0| 2c 20 30 2c 20 70 57 45 | 2d 3e 6e 4c 69 6e 65 73 |, 0, pWE|->nLines|
|00001ce0| 20 2d 20 31 29 3b 0d 0d | 09 2f 2f 20 66 69 6e 64 | - 1);..|.// find|
|00001cf0| 20 77 68 65 72 65 20 69 | 6e 20 74 68 65 20 74 65 | where i|n the te|
|00001d00| 78 74 20 72 65 63 61 6c | 63 75 6c 61 74 69 6f 6e |xt recal|culation|
|00001d10| 20 73 68 6f 75 6c 64 20 | 62 65 67 69 6e 0d 09 6c | should |begin..l|
|00001d20| 69 6e 65 49 6e 66 6f 20 | 3d 20 28 2a 70 57 45 2d |ineInfo |= (*pWE-|
|00001d30| 3e 68 4c 69 6e 65 73 29 | 5b 6c 69 6e 65 49 6e 64 |>hLines)|[lineInd|
|00001d40| 65 78 5d 3b 0d 0d 09 2f | 2f 20 73 61 76 65 20 74 |ex];.../|/ save t|
|00001d50| 68 65 20 51 75 69 63 6b | 64 72 61 77 20 65 6e 76 |he Quick|draw env|
|00001d60| 69 72 6f 6e 6d 65 6e 74 | 0d 09 5f 57 45 53 61 76 |ironment|.._WESav|
|00001d70| 65 51 44 45 6e 76 69 72 | 6f 6e 6d 65 6e 74 28 70 |eQDEnvir|onment(p|
|00001d80| 57 45 2d 3e 70 6f 72 74 | 2c 20 66 61 6c 73 65 2c |WE->port|, false,|
|00001d90| 20 26 73 61 76 65 45 6e | 76 69 72 6f 6e 6d 65 6e | &saveEn|vironmen|
|00001da0| 74 29 3b 0d 0d 09 2f 2f | 20 4d 41 49 4e 20 4c 49 |t);...//| MAIN LI|
|00001db0| 4e 45 20 42 52 45 41 4b | 49 4e 47 20 4c 4f 4f 50 |NE BREAK|ING LOOP|
|00001dc0| 0d 09 64 6f 0d 09 7b 0d | 09 09 2f 2f 20 66 69 6e |..do..{.|..// fin|
|00001dd0| 64 20 77 68 65 72 65 20 | 74 6f 20 62 72 65 61 6b |d where |to break|
|00001de0| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 6c 69 6e | the cur|rent lin|
|00001df0| 65 0d 09 09 6c 69 6e 65 | 4f 66 66 73 65 74 20 3d |e...line|Offset =|
|00001e00| 20 5f 57 45 46 69 6e 64 | 4c 69 6e 65 42 72 65 61 | _WEFind|LineBrea|
|00001e10| 6b 28 6c 69 6e 65 49 6e | 66 6f 2e 6c 69 6e 65 53 |k(lineIn|fo.lineS|
|00001e20| 74 61 72 74 2c 20 68 57 | 45 29 3b 0d 0d 09 09 2f |tart, hW|E);..../|
|00001e30| 2f 20 6d 61 6b 65 20 73 | 75 72 65 20 77 65 20 61 |/ make s|ure we a|
|00001e40| 64 76 61 6e 63 65 20 61 | 74 20 6c 65 61 73 74 20 |dvance a|t least |
|00001e50| 62 79 20 6f 6e 65 20 63 | 68 61 72 61 63 74 65 72 |by one c|haracter|
|00001e60| 20 28 75 6e 6c 65 73 73 | 20 77 65 20 72 65 61 63 | (unless| we reac|
|00001e70| 68 65 64 20 74 68 65 20 | 65 6e 64 20 6f 66 20 74 |hed the |end of t|
|00001e80| 65 78 74 29 0d 09 09 69 | 66 20 28 28 6c 69 6e 65 |ext)...i|f ((line|
|00001e90| 4f 66 66 73 65 74 20 3c | 3d 20 30 29 20 26 26 20 |Offset <|= 0) && |
|00001ea0| 28 6c 69 6e 65 49 6e 66 | 6f 2e 6c 69 6e 65 53 74 |(lineInf|o.lineSt|
|00001eb0| 61 72 74 20 3c 20 70 57 | 45 2d 3e 74 65 78 74 4c |art < pW|E->textL|
|00001ec0| 65 6e 67 74 68 29 29 0d | 09 09 7b 0d 09 09 09 6c |ength)).|..{....l|
|00001ed0| 69 6e 65 4f 66 66 73 65 | 74 20 3d 20 31 3b 0d 09 |ineOffse|t = 1;..|
|00001ee0| 09 7d 0d 0d 09 09 2f 2f | 20 63 61 6c 63 75 6c 61 |.}....//| calcula|
|00001ef0| 74 65 20 61 73 63 65 6e | 74 20 61 6e 64 20 64 65 |te ascen|t and de|
|00001f00| 73 63 65 6e 74 20 76 61 | 6c 75 65 73 20 66 6f 72 |scent va|lues for|
|00001f10| 20 74 68 69 73 20 6c 69 | 6e 65 0d 09 09 5f 57 45 | this li|ne..._WE|
|00001f20| 43 61 6c 63 48 65 69 67 | 68 74 73 28 6c 69 6e 65 |CalcHeig|hts(line|
|00001f30| 49 6e 66 6f 2e 6c 69 6e | 65 53 74 61 72 74 2c 20 |Info.lin|eStart, |
|00001f40| 6c 69 6e 65 49 6e 66 6f | 2e 6c 69 6e 65 53 74 61 |lineInfo|.lineSta|
|00001f50| 72 74 20 2b 20 6c 69 6e | 65 4f 66 66 73 65 74 2c |rt + lin|eOffset,|
|00001f60| 20 26 6c 69 6e 65 41 73 | 63 65 6e 74 2c 20 26 6c | &lineAs|cent, &l|
|00001f70| 69 6e 65 44 65 73 63 65 | 6e 74 2c 20 68 57 45 29 |ineDesce|nt, hWE)|
|00001f80| 3b 0d 0d 09 09 2f 2f 20 | 73 61 76 65 20 74 68 65 |;....// |save the|
|00001f90| 20 6d 61 78 69 6d 75 6d | 20 6c 69 6e 65 20 61 73 | maximum| line as|
|00001fa0| 63 65 6e 74 20 66 6f 72 | 20 74 68 69 73 20 6c 69 |cent for| this li|
|00001fb0| 6e 65 20 69 6e 20 74 68 | 65 20 6c 69 6e 65 20 61 |ne in th|e line a|
|00001fc0| 72 72 61 79 0d 09 09 70 | 4c 69 6e 65 20 3d 20 2a |rray...p|Line = *|
|00001fd0| 70 57 45 2d 3e 68 4c 69 | 6e 65 73 20 2b 20 6c 69 |pWE->hLi|nes + li|
|00001fe0| 6e 65 49 6e 64 65 78 3b | 0d 09 09 70 4c 69 6e 65 |neIndex;|...pLine|
|00001ff0| 2d 3e 6c 69 6e 65 41 73 | 63 65 6e 74 20 3d 20 6c |->lineAs|cent = l|
|00002000| 69 6e 65 41 73 63 65 6e | 74 3b 0d 0d 09 09 2f 2f |ineAscen|t;....//|
|00002010| 20 69 6e 63 72 65 6d 65 | 6e 74 20 63 6f 75 6e 74 | increme|nt count|
|00002020| 65 72 73 20 28 67 6f 20 | 74 6f 20 74 68 65 20 6e |ers (go |to the n|
|00002030| 65 78 74 20 6c 69 6e 65 | 20 61 72 72 61 79 20 65 |ext line| array e|
|00002040| 6e 74 72 79 29 0d 09 09 | 6c 69 6e 65 49 6e 64 65 |ntry)...|lineInde|
|00002050| 78 2b 2b 3b 0d 09 09 6c | 69 6e 65 49 6e 66 6f 2e |x++;...l|ineInfo.|
|00002060| 6c 69 6e 65 53 74 61 72 | 74 20 2b 3d 20 6c 69 6e |lineStar|t += lin|
|00002070| 65 4f 66 66 73 65 74 3b | 0d 09 09 6c 69 6e 65 49 |eOffset;|...lineI|
|00002080| 6e 66 6f 2e 6c 69 6e 65 | 4f 72 69 67 69 6e 20 2b |nfo.line|Origin +|
|00002090| 3d 20 28 6c 69 6e 65 41 | 73 63 65 6e 74 20 2b 20 |= (lineA|scent + |
|000020a0| 6c 69 6e 65 44 65 73 63 | 65 6e 74 29 3b 0d 09 09 |lineDesc|ent);...|
|000020b0| 70 4c 69 6e 65 2b 2b 3b | 0d 0d 09 09 2f 2f 20 63 |pLine++;|....// c|
|000020c0| 6f 6d 70 61 72 65 20 74 | 68 65 20 6e 65 77 6c 79 |ompare t|he newly|
|000020d0| 20 63 61 6c 63 75 6c 61 | 74 65 64 20 6c 69 6e 65 | calcula|ted line|
|000020e0| 20 73 74 61 72 74 20 77 | 69 74 68 20 74 68 65 20 | start w|ith the |
|000020f0| 6f 6c 64 20 76 61 6c 75 | 65 0d 09 09 2f 2f 20 69 |old valu|e...// i|
|00002100| 66 20 74 68 65 20 6e 65 | 77 20 6c 69 6e 65 20 73 |f the ne|w line s|
|00002110| 74 61 72 74 20 63 6f 6d | 65 73 20 62 65 66 6f 72 |tart com|es befor|
|00002120| 65 20 74 68 65 20 6f 6c | 64 20 6c 69 6e 65 20 73 |e the ol|d line s|
|00002130| 74 61 72 74 2c 20 69 6e | 73 65 72 74 20 61 20 6e |tart, in|sert a n|
|00002140| 65 77 20 65 6c 65 6d 65 | 6e 74 0d 09 09 6f 6c 64 |ew eleme|nt...old|
|00002150| 4c 69 6e 65 49 6e 66 6f | 20 3d 20 2a 70 4c 69 6e |LineInfo| = *pLin|
|00002160| 65 3b 0d 09 09 69 66 20 | 28 28 6c 69 6e 65 49 6e |e;...if |((lineIn|
|00002170| 64 65 78 20 3e 20 70 57 | 45 2d 3e 6e 4c 69 6e 65 |dex > pW|E->nLine|
|00002180| 73 29 20 7c 7c 20 28 6c | 69 6e 65 49 6e 66 6f 2e |s) || (l|ineInfo.|
|00002190| 6c 69 6e 65 53 74 61 72 | 74 20 3c 20 6f 6c 64 4c |lineStar|t < oldL|
|000021a0| 69 6e 65 49 6e 66 6f 2e | 6c 69 6e 65 53 74 61 72 |ineInfo.|lineStar|
|000021b0| 74 29 29 0d 09 09 7b 0d | 09 09 09 69 66 20 28 28 |t))...{.|...if ((|
|000021c0| 65 72 72 20 3d 20 5f 57 | 45 49 6e 73 65 72 74 4c |err = _W|EInsertL|
|000021d0| 69 6e 65 28 6c 69 6e 65 | 49 6e 64 65 78 2c 20 26 |ine(line|Index, &|
|000021e0| 6c 69 6e 65 49 6e 66 6f | 2c 20 70 57 45 29 29 20 |lineInfo|, pWE)) |
|000021f0| 21 3d 20 6e 6f 45 72 72 | 29 0d 09 09 09 7b 0d 09 |!= noErr|)....{..|
|00002200| 09 09 09 67 6f 74 6f 20 | 63 6c 65 61 6e 75 70 3b |...goto |cleanup;|
|00002210| 0d 09 09 09 7d 0d 09 09 | 7d 0d 09 09 65 6c 73 65 |....}...|}...else|
|00002220| 0d 09 09 7b 0d 09 09 09 | 2f 2f 20 6f 76 65 72 77 |...{....|// overw|
|00002230| 72 69 74 65 20 74 68 65 | 20 6f 6c 64 20 65 6c 65 |rite the| old ele|
|00002240| 6d 65 6e 74 0d 09 09 09 | 70 4c 69 6e 65 2d 3e 6c |ment....|pLine->l|
|00002250| 69 6e 65 53 74 61 72 74 | 20 3d 20 6c 69 6e 65 49 |ineStart| = lineI|
|00002260| 6e 66 6f 2e 6c 69 6e 65 | 53 74 61 72 74 3b 0d 09 |nfo.line|Start;..|
|00002270| 09 09 70 4c 69 6e 65 2d | 3e 6c 69 6e 65 4f 72 69 |..pLine-|>lineOri|
|00002280| 67 69 6e 20 3d 20 6c 69 | 6e 65 49 6e 66 6f 2e 6c |gin = li|neInfo.l|
|00002290| 69 6e 65 4f 72 69 67 69 | 6e 3b 0d 0d 09 09 09 2f |ineOrigi|n;...../|
|000022a0| 2f 20 72 65 6d 6f 76 65 | 20 61 6c 6c 20 66 75 72 |/ remove| all fur|
|000022b0| 74 68 65 72 20 65 6c 65 | 6d 65 6e 74 73 20 77 68 |ther ele|ments wh|
|000022c0| 69 63 68 20 68 61 76 65 | 20 61 20 6c 69 6e 65 53 |ich have| a lineS|
|000022d0| 74 61 72 74 20 66 69 65 | 6c 64 0d 09 09 09 2f 2f |tart fie|ld....//|
|000022e0| 20 6c 65 73 73 20 74 68 | 61 6e 20 6f 72 20 65 71 | less th|an or eq|
|000022f0| 75 61 6c 20 74 6f 20 74 | 68 65 20 63 75 72 72 65 |ual to t|he curre|
|00002300| 6e 74 20 6f 6e 65 0d 09 | 09 09 77 68 69 6c 65 28 |nt one..|..while(|
|00002310| 28 6c 69 6e 65 49 6e 64 | 65 78 20 3c 20 70 57 45 |(lineInd|ex < pWE|
|00002320| 2d 3e 6e 4c 69 6e 65 73 | 29 20 26 26 20 28 6c 69 |->nLines|) && (li|
|00002330| 6e 65 49 6e 66 6f 2e 6c | 69 6e 65 53 74 61 72 74 |neInfo.l|ineStart|
|00002340| 20 3e 3d 20 28 70 4c 69 | 6e 65 20 2b 20 31 29 2d | >= (pLi|ne + 1)-|
|00002350| 3e 6c 69 6e 65 53 74 61 | 72 74 29 29 0d 09 09 09 |>lineSta|rt))....|
|00002360| 09 5f 57 45 52 65 6d 6f | 76 65 4c 69 6e 65 28 6c |._WERemo|veLine(l|
|00002370| 69 6e 65 49 6e 64 65 78 | 20 2b 20 31 2c 20 70 57 |ineIndex| + 1, pW|
|00002380| 45 29 3b 0d 0d 09 09 09 | 2f 2f 20 69 66 20 74 68 |E);.....|// if th|
|00002390| 65 20 6e 65 77 20 6c 69 | 6e 65 20 73 74 61 72 74 |e new li|ne start|
|000023a0| 20 69 73 20 74 68 65 20 | 73 61 6d 65 20 61 73 20 | is the |same as |
|000023b0| 74 68 65 20 6f 6c 64 20 | 6f 6e 65 2e 2e 2e 0d 09 |the old |one.....|
|000023c0| 09 09 69 66 20 28 6c 69 | 6e 65 49 6e 66 6f 2e 6c |..if (li|neInfo.l|
|000023d0| 69 6e 65 53 74 61 72 74 | 20 3d 3d 20 6f 6c 64 4c |ineStart| == oldL|
|000023e0| 69 6e 65 49 6e 66 6f 2e | 6c 69 6e 65 53 74 61 72 |ineInfo.|lineStar|
|000023f0| 74 29 0d 09 09 09 7b 0d | 09 09 09 09 2f 2f 20 2e |t)....{.|....// .|
|00002400| 2e 2e 61 6e 64 20 72 65 | 63 61 6c 54 68 72 65 73 |..and re|calThres|
|00002410| 68 6f 6c 64 20 68 61 73 | 20 62 65 65 6e 20 72 65 |hold has| been re|
|00002420| 61 63 68 65 64 2c 20 77 | 65 20 63 61 6e 20 73 74 |ached, w|e can st|
|00002430| 6f 70 20 72 65 63 61 6c | 63 75 6c 61 74 69 6e 67 |op recal|culating|
|00002440| 20 6c 69 6e 65 20 62 72 | 65 61 6b 73 0d 09 09 09 | line br|eaks....|
|00002450| 09 69 66 20 28 6c 69 6e | 65 49 6e 66 6f 2e 6c 69 |.if (lin|eInfo.li|
|00002460| 6e 65 53 74 61 72 74 20 | 3e 3d 20 72 65 63 61 6c |neStart |>= recal|
|00002470| 54 68 72 65 73 68 6f 6c | 64 29 0d 09 09 09 09 7b |Threshol|d).....{|
|00002480| 0d 09 09 09 09 09 2f 2f | 20 61 6c 74 68 6f 75 67 |......//| althoug|
|00002490| 68 20 6c 69 6e 65 20 62 | 72 65 61 6b 73 20 6e 65 |h line b|reaks ne|
|000024a0| 65 64 20 6e 6f 74 20 62 | 65 20 63 68 61 6e 67 65 |ed not b|e change|
|000024b0| 64 20 66 72 6f 6d 20 6c | 69 6e 65 49 6e 64 65 78 |d from l|ineIndex|
|000024c0| 20 6f 6e 2c 0d 09 09 09 | 09 09 2f 2f 20 74 68 65 | on,....|..// the|
|000024d0| 20 6c 69 6e 65 4f 72 69 | 67 69 6e 20 66 69 65 6c | lineOri|gin fiel|
|000024e0| 64 73 20 6d 61 79 20 6e | 65 65 64 20 74 6f 20 62 |ds may n|eed to b|
|000024f0| 65 20 63 68 61 6e 67 65 | 64 0d 09 09 09 09 09 69 |e change|d......i|
|00002500| 66 20 28 6c 69 6e 65 49 | 6e 66 6f 2e 6c 69 6e 65 |f (lineI|nfo.line|
|00002510| 4f 72 69 67 69 6e 20 21 | 3d 20 6f 6c 64 4c 69 6e |Origin !|= oldLin|
|00002520| 65 49 6e 66 6f 2e 6c 69 | 6e 65 4f 72 69 67 69 6e |eInfo.li|neOrigin|
|00002530| 29 0d 09 09 09 09 09 7b | 0d 09 09 09 09 09 09 5f |)......{|......._|
|00002540| 57 45 42 75 6d 70 4f 72 | 69 67 69 6e 28 6c 69 6e |WEBumpOr|igin(lin|
|00002550| 65 49 6e 64 65 78 20 2b | 20 31 2c 20 6c 69 6e 65 |eIndex +| 1, line|
|00002560| 49 6e 66 6f 2e 6c 69 6e | 65 4f 72 69 67 69 6e 20 |Info.lin|eOrigin |
|00002570| 2d 20 6f 6c 64 4c 69 6e | 65 49 6e 66 6f 2e 6c 69 |- oldLin|eInfo.li|
|00002580| 6e 65 4f 72 69 67 69 6e | 2c 20 70 57 45 29 3b 0d |neOrigin|, pWE);.|
|00002590| 09 09 09 09 09 7d 0d 0d | 09 09 09 09 09 2f 2f 20 |.....}..|.....// |
|000025a0| 65 78 69 74 20 66 72 6f | 6d 20 74 68 65 20 6c 69 |exit fro|m the li|
|000025b0| 6e 65 20 62 72 65 61 6b | 69 6e 67 20 6c 6f 6f 70 |ne break|ing loop|
|000025c0| 0d 09 09 09 09 09 67 6f | 74 6f 20 63 6c 65 61 6e |......go|to clean|
|000025d0| 75 70 3b 0d 09 09 09 09 | 7d 0d 09 09 09 7d 0d 09 |up;.....|}....}..|
|000025e0| 09 09 65 6c 73 65 0d 09 | 09 09 7b 0d 09 09 09 09 |..else..|..{.....|
|000025f0| 2f 2f 20 6f 74 68 65 72 | 77 69 73 65 2c 20 74 68 |// other|wise, th|
|00002600| 65 20 6e 65 77 20 6c 69 | 6e 65 20 73 74 61 72 74 |e new li|ne start|
|00002610| 20 63 6f 6d 65 73 20 61 | 66 74 65 72 20 74 68 65 | comes a|fter the|
|00002620| 20 6f 6c 64 20 6c 69 6e | 65 20 73 74 61 72 74 2e | old lin|e start.|
|00002630| 2e 2e 0d 09 09 09 09 2f | 2f 20 69 66 20 74 68 65 |......./|/ if the|
|00002640| 20 63 75 72 72 65 6e 74 | 20 6c 69 6e 65 20 69 73 | current| line is|
|00002650| 20 74 68 65 20 6f 6e 65 | 20 70 72 65 63 65 64 69 | the one| precedi|
|00002660| 6e 67 20 73 74 61 72 74 | 4c 69 6e 65 2c 20 77 61 |ng start|Line, wa|
|00002670| 72 6e 20 6f 75 72 20 63 | 61 6c 6c 65 72 20 61 62 |rn our c|aller ab|
|00002680| 6f 75 74 20 74 68 69 73 | 0d 09 09 09 09 69 66 20 |out this|.....if |
|00002690| 28 28 6c 69 6e 65 49 6e | 64 65 78 20 3e 20 30 29 |((lineIn|dex > 0)|
|000026a0| 20 26 26 20 28 6c 69 6e | 65 49 6e 64 65 78 20 3d | && (lin|eIndex =|
|000026b0| 3d 20 2a 73 74 61 72 74 | 4c 69 6e 65 29 29 0d 09 |= *start|Line))..|
|000026c0| 09 09 09 7b 0d 09 09 09 | 09 09 2a 73 74 61 72 74 |...{....|..*start|
|000026d0| 4c 69 6e 65 20 3d 20 6c | 69 6e 65 49 6e 64 65 78 |Line = l|ineIndex|
|000026e0| 20 2d 20 31 3b 0d 09 09 | 09 09 7d 0d 09 09 09 7d | - 1;...|..}....}|
|000026f0| 0d 09 09 7d 0d 09 7d 20 | 77 68 69 6c 65 28 6c 69 |...}..} |while(li|
|00002700| 6e 65 49 6e 66 6f 2e 6c | 69 6e 65 53 74 61 72 74 |neInfo.l|ineStart|
|00002710| 20 3c 20 70 57 45 2d 3e | 74 65 78 74 4c 65 6e 67 | < pWE->|textLeng|
|00002720| 74 68 29 3b 0d 0d 63 6c | 65 61 6e 75 70 3a 0d 09 |th);..cl|eanup:..|
|00002730| 2f 2f 20 63 61 6c 63 75 | 6c 61 74 65 20 74 6f 74 |// calcu|late tot|
|00002740| 61 6c 20 74 65 78 74 20 | 68 65 69 67 68 74 0d 09 |al text |height..|
|00002750| 74 65 78 74 48 65 69 67 | 68 74 20 3d 20 57 45 47 |textHeig|ht = WEG|
|00002760| 65 74 48 65 69 67 68 74 | 28 30 2c 20 70 57 45 2d |etHeight|(0, pWE-|
|00002770| 3e 6e 4c 69 6e 65 73 2c | 20 68 57 45 29 3b 0d 0d |>nLines,| hWE);..|
|00002780| 09 2f 2f 20 71 75 69 72 | 6b 3a 20 69 66 20 74 68 |.// quir|k: if th|
|00002790| 65 20 6c 61 73 74 20 63 | 68 61 72 61 63 74 65 72 |e last c|haracter|
|000027a0| 20 69 6e 20 74 68 65 20 | 74 65 78 74 20 69 73 20 | in the |text is |
|000027b0| 61 20 63 61 72 72 69 61 | 67 65 20 72 65 74 75 72 |a carria|ge retur|
|000027c0| 6e 2c 20 74 68 65 20 63 | 61 72 65 74 20 61 70 70 |n, the c|aret app|
|000027d0| 65 61 72 73 0d 09 2f 2f | 20 62 65 6c 6f 77 20 74 |ears..//| below t|
|000027e0| 68 65 20 6c 61 73 74 20 | 6c 69 6e 65 2c 20 73 6f |he last |line, so|
|000027f0| 20 69 6e 20 74 68 69 73 | 20 63 61 73 65 20 77 65 | in this| case we|
|00002800| 20 6e 65 65 64 20 74 6f | 20 61 64 64 20 74 68 65 | need to| add the|
|00002810| 20 65 78 74 72 61 20 68 | 65 69 67 68 74 20 74 6f | extra h|eight to|
|00002820| 20 74 65 78 74 48 65 69 | 67 68 74 0d 09 69 66 20 | textHei|ght..if |
|00002830| 28 57 45 47 65 74 43 68 | 61 72 28 70 57 45 2d 3e |(WEGetCh|ar(pWE->|
|00002840| 74 65 78 74 4c 65 6e 67 | 74 68 20 2d 20 31 2c 20 |textLeng|th - 1, |
|00002850| 68 57 45 29 20 3d 3d 20 | 6b 45 4f 4c 29 0d 09 7b |hWE) == |kEOL)..{|
|00002860| 0d 09 09 74 65 78 74 48 | 65 69 67 68 74 20 2b 3d |...textH|eight +=|
|00002870| 20 57 45 47 65 74 48 65 | 69 67 68 74 28 70 57 45 | WEGetHe|ight(pWE|
|00002880| 2d 3e 6e 4c 69 6e 65 73 | 20 2d 20 31 2c 20 70 57 |->nLines| - 1, pW|
|00002890| 45 2d 3e 6e 4c 69 6e 65 | 73 2c 20 68 57 45 29 3b |E->nLine|s, hWE);|
|000028a0| 0d 09 7d 0d 0d 09 2f 2f | 20 69 66 20 74 6f 74 61 |..}...//| if tota|
|000028b0| 6c 20 74 65 78 74 20 68 | 65 69 67 68 74 20 68 61 |l text h|eight ha|
|000028c0| 73 20 63 68 61 6e 67 65 | 64 2c 20 72 65 6d 65 6d |s change|d, remem|
|000028d0| 62 65 72 20 74 6f 20 63 | 61 6c 6c 20 74 68 65 20 |ber to c|all the |
|000028e0| 73 63 72 6f 6c 6c 20 63 | 61 6c 6c 62 61 63 6b 20 |scroll c|allback |
|000028f0| 6c 61 74 65 72 0d 09 69 | 66 20 28 74 65 78 74 48 |later..i|f (textH|
|00002900| 65 69 67 68 74 20 21 3d | 20 70 57 45 2d 3e 64 65 |eight !=| pWE->de|
|00002910| 73 74 52 65 63 74 2e 62 | 6f 74 74 6f 6d 20 2d 20 |stRect.b|ottom - |
|00002920| 70 57 45 2d 3e 64 65 73 | 74 52 65 63 74 2e 74 6f |pWE->des|tRect.to|
|00002930| 70 29 0d 09 7b 0d 09 09 | 42 53 45 54 28 70 57 45 |p)..{...|BSET(pWE|
|00002940| 2d 3e 66 6c 61 67 73 2c | 20 77 65 46 44 65 73 74 |->flags,| weFDest|
|00002950| 52 65 63 74 43 68 61 6e | 67 65 64 29 3b 0d 09 7d |RectChan|ged);..}|
|00002960| 0d 0d 09 2f 2f 20 73 65 | 74 20 64 65 73 74 52 65 |...// se|t destRe|
|00002970| 63 74 2e 62 6f 74 74 6f | 6d 20 74 6f 20 64 65 73 |ct.botto|m to des|
|00002980| 74 52 65 63 74 2e 74 6f | 70 20 2b 20 74 6f 74 61 |tRect.to|p + tota|
|00002990| 6c 20 74 65 78 74 20 68 | 65 69 67 68 74 0d 09 70 |l text h|eight..p|
|000029a0| 57 45 2d 3e 64 65 73 74 | 52 65 63 74 2e 62 6f 74 |WE->dest|Rect.bot|
|000029b0| 74 6f 6d 20 3d 20 70 57 | 45 2d 3e 64 65 73 74 52 |tom = pW|E->destR|
|000029c0| 65 63 74 2e 74 6f 70 20 | 2b 20 74 65 78 74 48 65 |ect.top |+ textHe|
|000029d0| 69 67 68 74 3b 0d 0d 09 | 2f 2f 20 72 65 74 75 72 |ight;...|// retur|
|000029e0| 6e 20 74 68 72 6f 75 67 | 68 20 65 6e 64 4c 69 6e |n throug|h endLin|
|000029f0| 65 20 74 68 65 20 69 6e | 64 65 78 20 6f 66 20 74 |e the in|dex of t|
|00002a00| 68 65 20 6c 61 73 74 20 | 6c 69 6e 65 20 61 66 66 |he last |line aff|
|00002a10| 65 63 74 65 64 20 62 79 | 20 72 65 63 61 6c 63 75 |ected by| recalcu|
|00002a20| 6c 61 74 69 6f 6e 0d 09 | 2a 65 6e 64 4c 69 6e 65 |lation..|*endLine|
|00002a30| 20 3d 20 6c 69 6e 65 49 | 6e 64 65 78 20 2d 20 31 | = lineI|ndex - 1|
|00002a40| 3b 0d 0d 09 2f 2f 20 6d | 61 6b 65 20 73 75 72 65 |;...// m|ake sure|
|00002a50| 20 73 74 61 72 74 4c 69 | 6e 65 20 69 73 6e 27 74 | startLi|ne isn't|
|00002a60| 20 67 72 65 61 74 65 72 | 20 74 68 61 6e 20 65 6e | greater| than en|
|00002a70| 64 4c 69 6e 65 0d 09 69 | 66 20 28 2a 73 74 61 72 |dLine..i|f (*star|
|00002a80| 74 4c 69 6e 65 20 3e 20 | 2a 65 6e 64 4c 69 6e 65 |tLine > |*endLine|
|00002a90| 29 0d 09 7b 0d 09 09 2a | 73 74 61 72 74 4c 69 6e |)..{...*|startLin|
|00002aa0| 65 20 3d 20 2a 65 6e 64 | 4c 69 6e 65 3b 0d 09 7d |e = *end|Line;..}|
|00002ab0| 0d 0d 09 2f 2f 20 75 6e | 6c 6f 63 6b 20 74 68 65 |...// un|lock the|
|00002ac0| 20 74 65 78 74 0d 09 5f | 57 45 53 65 74 48 61 6e | text.._|WESetHan|
|00002ad0| 64 6c 65 4c 6f 63 6b 28 | 70 57 45 2d 3e 68 54 65 |dleLock(|pWE->hTe|
|00002ae0| 78 74 2c 20 73 61 76 65 | 54 65 78 74 4c 6f 63 6b |xt, save|TextLock|
|00002af0| 29 3b 0d 0d 09 2f 2f 20 | 72 65 73 74 6f 72 65 20 |);...// |restore |
|00002b00| 74 68 65 20 51 75 69 63 | 6b 64 72 61 77 20 65 6e |the Quic|kdraw en|
|00002b10| 76 69 72 6f 6e 6d 65 6e | 74 0d 09 5f 57 45 52 65 |vironmen|t.._WERe|
|00002b20| 73 74 6f 72 65 51 44 45 | 6e 76 69 72 6f 6e 6d 65 |storeQDE|nvironme|
|00002b30| 6e 74 28 26 73 61 76 65 | 45 6e 76 69 72 6f 6e 6d |nt(&save|Environm|
|00002b40| 65 6e 74 29 3b 0d 0d 09 | 2f 2f 20 72 65 74 75 72 |ent);...|// retur|
|00002b50| 6e 20 72 65 73 75 6c 74 | 20 63 6f 64 65 0d 09 72 |n result| code..r|
|00002b60| 65 74 75 72 6e 20 65 72 | 72 3b 0d 7d 0d 0d 73 74 |eturn er|r;.}..st|
|00002b70| 61 74 69 63 20 42 6f 6f | 6c 65 61 6e 20 53 4c 43 |atic Boo|lean SLC|
|00002b80| 61 6c 63 53 6c 6f 70 0d | 09 28 0d 09 09 57 45 4c |alcSlop.|.(...WEL|
|00002b90| 69 6e 65 52 65 63 20 2a | 70 4c 69 6e 65 2c 0d 09 |ineRec *|pLine,..|
|00002ba0| 09 63 6f 6e 73 74 20 57 | 45 52 75 6e 41 74 74 72 |.const W|ERunAttr|
|00002bb0| 69 62 75 74 65 73 20 2a | 70 41 74 74 72 73 2c 0d |ibutes *|pAttrs,.|
|00002bc0| 09 09 50 74 72 20 70 53 | 65 67 6d 65 6e 74 2c 0d |..Ptr pS|egment,.|
|00002bd0| 09 09 53 49 6e 74 33 32 | 20 73 65 67 6d 65 6e 74 |..SInt32| segment|
|00002be0| 53 74 61 72 74 2c 0d 09 | 09 53 49 6e 74 33 32 20 |Start,..|.SInt32 |
|00002bf0| 73 65 67 6d 65 6e 74 4c | 65 6e 67 74 68 2c 0d 09 |segmentL|ength,..|
|00002c00| 09 4a 75 73 74 53 74 79 | 6c 65 43 6f 64 65 20 73 |.JustSty|leCode s|
|00002c10| 74 79 6c 65 52 75 6e 50 | 6f 73 69 74 69 6f 6e 2c |tyleRunP|osition,|
|00002c20| 0d 09 09 57 45 48 61 6e | 64 6c 65 20 68 57 45 2c |...WEHan|dle hWE,|
|00002c30| 0d 09 09 76 6f 69 64 20 | 2a 63 61 6c 6c 62 61 63 |...void |*callbac|
|00002c40| 6b 44 61 74 61 0d 09 29 | 0d 7b 0d 23 69 66 20 21 |kData..)|.{.#if !|
|00002c50| 57 41 53 54 45 5f 4f 42 | 4a 45 43 54 53 0d 09 23 |WASTE_OB|JECTS..#|
|00002c60| 70 72 61 67 6d 61 20 75 | 6e 75 73 65 64 28 70 41 |pragma u|nused(pA|
|00002c70| 74 74 72 73 29 0d 23 65 | 6e 64 69 66 0d 09 73 74 |ttrs).#e|ndif..st|
|00002c80| 72 75 63 74 20 53 4c 43 | 61 6c 63 53 6c 6f 70 44 |ruct SLC|alcSlopD|
|00002c90| 61 74 61 20 2a 63 64 20 | 3d 20 28 73 74 72 75 63 |ata *cd |= (struc|
|00002ca0| 74 20 53 4c 43 61 6c 63 | 53 6c 6f 70 44 61 74 61 |t SLCalc|SlopData|
|00002cb0| 20 2a 29 20 63 61 6c 6c | 62 61 63 6b 44 61 74 61 | *) call|backData|
|00002cc0| 3b 0d 09 53 49 6e 74 31 | 36 20 73 65 67 6d 65 6e |;..SInt1|6 segmen|
|00002cd0| 74 57 69 64 74 68 3b 0d | 09 46 69 78 65 64 20 73 |tWidth;.|.Fixed s|
|00002ce0| 65 67 6d 65 6e 74 50 72 | 6f 70 6f 72 74 69 6f 6e |egmentPr|oportion|
|00002cf0| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 20 69 73 45 6e 64 |;..Boole|an isEnd|
|00002d00| 4f 66 4c 69 6e 65 3b 0d | 0d 09 2f 2f 20 73 65 65 |OfLine;.|..// see|
|00002d10| 20 69 66 20 74 68 69 73 | 20 74 65 78 74 20 73 65 | if this| text se|
|00002d20| 67 6d 65 6e 74 20 65 6e | 64 73 20 77 69 74 68 20 |gment en|ds with |
|00002d30| 61 20 63 61 72 72 69 61 | 67 65 20 72 65 74 75 72 |a carria|ge retur|
|00002d40| 6e 2c 20 6f 72 20 69 66 | 20 77 65 27 76 65 20 72 |n, or if| we've r|
|00002d50| 65 61 63 68 65 64 20 74 | 68 65 0d 09 2f 2f 20 65 |eached t|he..// e|
|00002d60| 6e 64 20 6f 66 20 74 68 | 65 20 74 65 78 74 20 28 |nd of th|e text (|
|00002d70| 69 6e 20 77 68 69 63 68 | 20 63 61 73 65 20 77 65 |in which| case we|
|00002d80| 20 64 6f 6e 27 74 20 77 | 61 6e 74 20 61 6e 79 20 | don't w|ant any |
|00002d90| 6a 75 73 74 69 66 69 63 | 61 74 69 6f 6e 20 74 6f |justific|ation to|
|00002da0| 20 74 61 6b 65 20 70 6c | 61 63 65 29 0d 09 69 73 | take pl|ace)..is|
|00002db0| 45 6e 64 4f 66 4c 69 6e | 65 20 3d 20 28 73 65 67 |EndOfLin|e = (seg|
|00002dc0| 6d 65 6e 74 53 74 61 72 | 74 20 2b 20 73 65 67 6d |mentStar|t + segm|
|00002dd0| 65 6e 74 4c 65 6e 67 74 | 68 20 3e 3d 20 28 2a 68 |entLengt|h >= (*h|
|00002de0| 57 45 29 2d 3e 74 65 78 | 74 4c 65 6e 67 74 68 29 |WE)->tex|tLength)|
|00002df0| 20 7c 7c 0d 09 09 09 09 | 20 20 28 70 53 65 67 6d | ||.....| (pSegm|
|00002e00| 65 6e 74 20 5b 20 73 65 | 67 6d 65 6e 74 4c 65 6e |ent [ se|gmentLen|
|00002e10| 67 74 68 20 2d 20 31 20 | 5d 20 3d 3d 20 6b 45 4f |gth - 1 |] == kEO|
|00002e20| 4c 29 3b 0d 0d 09 2f 2f | 20 69 66 20 74 68 69 73 |L);...//| if this|
|00002e30| 20 69 73 20 74 68 65 20 | 66 69 72 73 74 20 73 65 | is the |first se|
|00002e40| 67 6d 65 6e 74 20 6f 6e | 20 74 68 65 20 6c 69 6e |gment on| the lin|
|00002e50| 65 2c 20 72 65 73 65 74 | 20 6c 69 6e 65 20 74 6f |e, reset| line to|
|00002e60| 74 61 6c 73 0d 09 69 66 | 20 28 49 53 5f 4c 45 46 |tals..if| (IS_LEF|
|00002e70| 54 4d 4f 53 54 5f 52 55 | 4e 28 73 74 79 6c 65 52 |TMOST_RU|N(styleR|
|00002e80| 75 6e 50 6f 73 69 74 69 | 6f 6e 29 29 0d 09 7b 0d |unPositi|on))..{.|
|00002e90| 09 09 63 64 2d 3e 74 6f | 74 61 6c 53 6c 6f 70 20 |..cd->to|talSlop |
|00002ea0| 3d 20 63 64 2d 3e 6c 69 | 6e 65 57 69 64 74 68 3b |= cd->li|neWidth;|
|00002eb0| 0d 09 09 63 64 2d 3e 74 | 6f 74 61 6c 50 72 6f 70 |...cd->t|otalProp|
|00002ec0| 6f 72 74 69 6f 6e 20 3d | 20 30 3b 0d 09 7d 0d 0d |ortion =| 0;..}..|
|00002ed0| 23 69 66 20 57 41 53 54 | 45 5f 4f 42 4a 45 43 54 |#if WAST|E_OBJECT|
|00002ee0| 53 0d 09 69 66 20 28 70 | 41 74 74 72 73 2d 3e 72 |S..if (p|Attrs->r|
|00002ef0| 75 6e 53 74 79 6c 65 2e | 74 73 4f 62 6a 65 63 74 |unStyle.|tsObject|
|00002f00| 20 21 3d 20 6e 69 6c 29 | 0d 09 7b 0d 09 09 2f 2f | != nil)|..{...//|
|00002f10| 20 45 4d 42 45 44 44 45 | 44 20 4f 42 4a 45 43 54 | EMBEDDE|D OBJECT|
|00002f20| 0d 09 09 2f 2f 20 73 65 | 67 6d 65 6e 74 20 77 69 |...// se|gment wi|
|00002f30| 64 74 68 20 69 73 20 6a | 75 73 74 20 6f 62 6a 65 |dth is j|ust obje|
|00002f40| 63 74 20 77 69 64 74 68 | 3b 20 6e 6f 20 65 78 74 |ct width|; no ext|
|00002f50| 72 61 20 73 70 61 63 65 | 20 63 61 6e 20 62 65 20 |ra space| can be |
|00002f60| 61 70 70 6c 69 65 64 20 | 66 6f 72 20 6a 75 73 74 |applied |for just|
|00002f70| 69 66 69 63 61 74 69 6f | 6e 0d 09 09 73 65 67 6d |ificatio|n...segm|
|00002f80| 65 6e 74 57 69 64 74 68 | 20 3d 20 28 2a 70 41 74 |entWidth| = (*pAt|
|00002f90| 74 72 73 2d 3e 72 75 6e | 53 74 79 6c 65 2e 74 73 |trs->run|Style.ts|
|00002fa0| 4f 62 6a 65 63 74 29 2d | 3e 6f 62 6a 65 63 74 53 |Object)-|>objectS|
|00002fb0| 69 7a 65 2e 68 3b 0d 09 | 09 73 65 67 6d 65 6e 74 |ize.h;..|.segment|
|00002fc0| 50 72 6f 70 6f 72 74 69 | 6f 6e 20 3d 20 30 3b 0d |Proporti|on = 0;.|
|00002fd0| 09 7d 0d 09 65 6c 73 65 | 0d 23 65 6e 64 69 66 0d |.}..else|.#endif.|
|00002fe0| 09 7b 0d 23 69 66 20 57 | 41 53 54 45 5f 53 43 41 |.{.#if W|ASTE_SCA|
|00002ff0| 4c 45 0d 09 09 63 6f 6e | 73 74 20 50 6f 69 6e 74 |LE...con|st Point|
|00003000| 20 73 63 61 6c 65 4e 75 | 6d 65 72 20 3d 20 28 2a | scaleNu|mer = (*|
|00003010| 68 57 45 29 2d 3e 73 63 | 61 6c 65 4e 75 6d 65 72 |hWE)->sc|aleNumer|
|00003020| 3b 0d 09 09 63 6f 6e 73 | 74 20 50 6f 69 6e 74 20 |;...cons|t Point |
|00003030| 73 63 61 6c 65 44 65 6e | 6f 6d 20 3d 20 28 2a 68 |scaleDen|om = (*h|
|00003040| 57 45 29 2d 3e 73 63 61 | 6c 65 44 65 6e 6f 6d 3b |WE)->sca|leDenom;|
|00003050| 0d 23 65 6c 73 65 0d 09 | 09 63 6f 6e 73 74 20 50 |.#else..|.const P|
|00003060| 6f 69 6e 74 20 73 63 61 | 6c 65 4e 75 6d 65 72 20 |oint sca|leNumer |
|00003070| 3d 20 6b 4f 6e 65 54 6f | 4f 6e 65 53 63 61 6c 69 |= kOneTo|OneScali|
|00003080| 6e 67 3b 0d 09 09 63 6f | 6e 73 74 20 50 6f 69 6e |ng;...co|nst Poin|
|00003090| 74 20 73 63 61 6c 65 44 | 65 6e 6f 6d 20 3d 20 6b |t scaleD|enom = k|
|000030a0| 4f 6e 65 54 6f 4f 6e 65 | 53 63 61 6c 69 6e 67 3b |OneToOne|Scaling;|
|000030b0| 0d 23 65 6e 64 69 66 0d | 0d 09 09 2f 2f 20 52 45 |.#endif.|...// RE|
|000030c0| 47 55 4c 41 52 20 54 45 | 58 54 0d 0d 09 09 2f 2f |GULAR TE|XT....//|
|000030d0| 20 69 66 20 74 68 69 73 | 20 69 73 20 74 68 65 20 | if this| is the |
|000030e0| 6c 61 73 74 20 73 65 67 | 6d 65 6e 74 20 6f 6e 20 |last seg|ment on |
|000030f0| 74 68 65 20 6c 69 6e 65 | 2c 20 73 74 72 69 70 20 |the line|, strip |
|00003100| 74 72 61 69 6c 69 6e 67 | 20 73 70 61 63 65 73 0d |trailing| spaces.|
|00003110| 09 09 69 66 20 28 49 53 | 5f 52 49 47 48 54 4d 4f |..if (IS|_RIGHTMO|
|00003120| 53 54 5f 52 55 4e 28 73 | 74 79 6c 65 52 75 6e 50 |ST_RUN(s|tyleRunP|
|00003130| 6f 73 69 74 69 6f 6e 29 | 29 0d 09 09 7b 0d 09 09 |osition)|)...{...|
|00003140| 09 73 65 67 6d 65 6e 74 | 4c 65 6e 67 74 68 20 3d |.segment|Length =|
|00003150| 20 56 69 73 69 62 6c 65 | 4c 65 6e 67 74 68 28 70 | Visible|Length(p|
|00003160| 53 65 67 6d 65 6e 74 2c | 20 73 65 67 6d 65 6e 74 |Segment,| segment|
|00003170| 4c 65 6e 67 74 68 29 3b | 0d 09 09 7d 0d 0d 09 09 |Length);|...}....|
|00003180| 2f 2f 20 6d 65 61 73 75 | 72 65 20 74 68 69 73 20 |// measu|re this |
|00003190| 73 65 67 6d 65 6e 74 0d | 09 09 73 65 67 6d 65 6e |segment.|..segmen|
|000031a0| 74 57 69 64 74 68 20 3d | 20 54 65 78 74 57 69 64 |tWidth =| TextWid|
|000031b0| 74 68 28 70 53 65 67 6d | 65 6e 74 2c 20 30 2c 20 |th(pSegm|ent, 0, |
|000031c0| 73 65 67 6d 65 6e 74 4c | 65 6e 67 74 68 29 3b 0d |segmentL|ength);.|
|000031d0| 0d 09 09 2f 2f 20 63 61 | 6c 63 75 6c 61 74 65 20 |...// ca|lculate |
|000031e0| 74 68 65 20 70 72 6f 70 | 6f 72 74 69 6f 6e 20 6f |the prop|ortion o|
|000031f0| 66 20 65 78 74 72 61 20 | 73 70 61 63 65 20 74 6f |f extra |space to|
|00003200| 20 61 70 70 6c 79 20 74 | 6f 20 74 68 69 73 20 74 | apply t|o this t|
|00003210| 65 78 74 20 73 65 67 6d | 65 6e 74 0d 09 09 73 65 |ext segm|ent...se|
|00003220| 67 6d 65 6e 74 50 72 6f | 70 6f 72 74 69 6f 6e 20 |gmentPro|portion |
|00003230| 3d 20 50 6f 72 74 69 6f | 6e 4c 69 6e 65 28 70 53 |= Portio|nLine(pS|
|00003240| 65 67 6d 65 6e 74 2c 20 | 73 65 67 6d 65 6e 74 4c |egment, |segmentL|
|00003250| 65 6e 67 74 68 2c 0d 09 | 09 09 09 73 74 79 6c 65 |ength,..|...style|
|00003260| 52 75 6e 50 6f 73 69 74 | 69 6f 6e 2c 20 73 63 61 |RunPosit|ion, sca|
|00003270| 6c 65 4e 75 6d 65 72 2c | 20 73 63 61 6c 65 44 65 |leNumer,| scaleDe|
|00003280| 6e 6f 6d 29 3b 0d 09 7d | 0d 0d 09 2f 2f 20 6b 65 |nom);..}|...// ke|
|00003290| 65 70 20 74 72 61 63 6b | 20 6f 66 20 6c 69 6e 65 |ep track| of line|
|000032a0| 20 74 6f 74 61 6c 73 0d | 09 63 64 2d 3e 74 6f 74 | totals.|.cd->tot|
|000032b0| 61 6c 53 6c 6f 70 20 2d | 3d 20 73 65 67 6d 65 6e |alSlop -|= segmen|
|000032c0| 74 57 69 64 74 68 3b 0d | 09 63 64 2d 3e 74 6f 74 |tWidth;.|.cd->tot|
|000032d0| 61 6c 50 72 6f 70 6f 72 | 74 69 6f 6e 20 2b 3d 20 |alPropor|tion += |
|000032e0| 73 65 67 6d 65 6e 74 50 | 72 6f 70 6f 72 74 69 6f |segmentP|roportio|
|000032f0| 6e 3b 0d 0d 09 2f 2f 20 | 69 66 20 74 68 69 73 20 |n;...// |if this |
|00003300| 69 73 20 74 68 65 20 6c | 61 73 74 20 73 65 67 6d |is the l|ast segm|
|00003310| 65 6e 74 20 6f 6e 20 74 | 68 65 20 6c 69 6e 65 2c |ent on t|he line,|
|00003320| 20 73 61 76 65 20 76 61 | 6c 75 65 73 20 69 6e 20 | save va|lues in |
|00003330| 74 68 65 20 6c 69 6e 65 | 20 61 72 72 61 79 0d 09 |the line| array..|
|00003340| 69 66 20 28 49 53 5f 52 | 49 47 48 54 4d 4f 53 54 |if (IS_R|IGHTMOST|
|00003350| 5f 52 55 4e 28 73 74 79 | 6c 65 52 75 6e 50 6f 73 |_RUN(sty|leRunPos|
|00003360| 69 74 69 6f 6e 29 29 0d | 09 7b 0d 09 09 2f 2f 20 |ition)).|.{...// |
|00003370| 6d 61 6b 65 20 73 75 72 | 65 20 73 6c 6f 70 20 69 |make sur|e slop i|
|00003380| 73 20 6e 6f 6e 2d 6e 65 | 67 61 74 69 76 65 0d 09 |s non-ne|gative..|
|00003390| 09 69 66 20 28 63 64 2d | 3e 74 6f 74 61 6c 53 6c |.if (cd-|>totalSl|
|000033a0| 6f 70 20 3c 20 30 29 0d | 09 09 7b 0d 09 09 09 63 |op < 0).|..{....c|
|000033b0| 64 2d 3e 74 6f 74 61 6c | 53 6c 6f 70 20 3d 20 30 |d->total|Slop = 0|
|000033c0| 3b 0d 09 09 7d 0d 09 09 | 70 4c 69 6e 65 2d 3e 6c |;...}...|pLine->l|
|000033d0| 69 6e 65 53 6c 6f 70 20 | 3d 20 63 64 2d 3e 74 6f |ineSlop |= cd->to|
|000033e0| 74 61 6c 53 6c 6f 70 3b | 0d 09 09 70 4c 69 6e 65 |talSlop;|...pLine|
|000033f0| 2d 3e 6c 69 6e 65 4a 75 | 73 74 41 6d 6f 75 6e 74 |->lineJu|stAmount|
|00003400| 20 3d 20 69 73 45 6e 64 | 4f 66 4c 69 6e 65 20 3f | = isEnd|OfLine ?|
|00003410| 20 30 20 3a 20 46 69 78 | 44 69 76 28 42 53 4c 28 | 0 : Fix|Div(BSL(|
|00003420| 63 64 2d 3e 74 6f 74 61 | 6c 53 6c 6f 70 2c 20 31 |cd->tota|lSlop, 1|
|00003430| 36 29 2c 20 63 64 2d 3e | 74 6f 74 61 6c 50 72 6f |6), cd->|totalPro|
|00003440| 70 6f 72 74 69 6f 6e 29 | 3b 0d 09 7d 0d 09 72 65 |portion)|;..}..re|
|00003450| 74 75 72 6e 20 66 61 6c | 73 65 3b 09 2f 2f 20 6b |turn fal|se;.// k|
|00003460| 65 65 70 20 6c 6f 6f 70 | 69 6e 67 0d 7d 0d 0d 70 |eep loop|ing.}..p|
|00003470| 61 73 63 61 6c 20 76 6f | 69 64 20 5f 57 45 52 65 |ascal vo|id _WERe|
|00003480| 63 61 6c 53 6c 6f 70 73 | 28 53 49 6e 74 33 32 20 |calSlops|(SInt32 |
|00003490| 66 69 72 73 74 4c 69 6e | 65 2c 20 53 49 6e 74 33 |firstLin|e, SInt3|
|000034a0| 32 20 6c 61 73 74 4c 69 | 6e 65 2c 20 57 45 48 61 |2 lastLi|ne, WEHa|
|000034b0| 6e 64 6c 65 20 68 57 45 | 29 0d 7b 0d 09 2f 2f 20 |ndle hWE|).{..// |
|000034c0| 43 61 6c 63 75 6c 61 74 | 65 73 20 74 68 65 20 6c |Calculat|es the l|
|000034d0| 69 6e 65 53 6c 6f 70 20 | 61 6e 64 20 6c 69 6e 65 |ineSlop |and line|
|000034e0| 4a 75 73 74 41 6d 6f 75 | 6e 74 20 66 69 65 6c 64 |JustAmou|nt field|
|000034f0| 73 0d 09 2f 2f 20 6f 66 | 20 74 68 65 20 6c 69 6e |s..// of| the lin|
|00003500| 65 20 61 72 72 61 79 20 | 66 6f 72 20 74 68 65 20 |e array |for the |
|00003510| 73 70 65 63 69 66 69 65 | 64 20 6c 69 6e 65 73 0d |specifie|d lines.|
|00003520| 0d 09 57 45 50 74 72 20 | 70 57 45 20 3d 20 2a 68 |..WEPtr |pWE = *h|
|00003530| 57 45 3b 0d 09 73 74 72 | 75 63 74 20 53 4c 43 61 |WE;..str|uct SLCa|
|00003540| 6c 63 53 6c 6f 70 44 61 | 74 61 20 63 64 3b 0d 0d |lcSlopDa|ta cd;..|
|00003550| 09 2f 2f 20 77 65 20 6f | 6e 6c 79 20 6e 65 65 64 |.// we o|nly need|
|00003560| 20 74 6f 20 62 6f 74 68 | 65 72 20 69 66 20 74 68 | to both|er if th|
|00003570| 65 20 75 73 65 72 20 69 | 73 6e 27 74 20 75 73 69 |e user i|sn't usi|
|00003580| 6e 67 20 6c 65 66 74 20 | 6a 75 73 74 69 66 69 63 |ng left |justific|
|00003590| 61 74 69 6f 6e 0d 09 69 | 66 20 28 70 57 45 2d 3e |ation..i|f (pWE->|
|000035a0| 61 6c 69 67 6e 6d 65 6e | 74 20 3d 3d 20 77 65 46 |alignmen|t == weF|
|000035b0| 6c 75 73 68 4c 65 66 74 | 29 0d 09 7b 0d 09 09 72 |lushLeft|)..{...r|
|000035c0| 65 74 75 72 6e 3b 0d 09 | 7d 0d 0d 09 2f 2f 20 63 |eturn;..|}...// c|
|000035d0| 61 6c 63 75 6c 61 74 65 | 20 73 6c 6f 70 20 61 6e |alculate| slop an|
|000035e0| 64 20 6e 6f 72 6d 61 6c | 69 7a 65 64 20 73 6c 6f |d normal|ized slo|
|000035f0| 70 20 70 72 6f 70 6f 72 | 74 69 6f 6e 20 66 6f 72 |p propor|tion for|
|00003600| 20 61 6c 6c 20 6c 69 6e | 65 73 0d 09 63 64 2e 6c | all lin|es..cd.l|
|00003610| 69 6e 65 57 69 64 74 68 | 20 3d 20 70 57 45 2d 3e |ineWidth| = pWE->|
|00003620| 64 65 73 74 52 65 63 74 | 2e 72 69 67 68 74 20 2d |destRect|.right -|
|00003630| 20 70 57 45 2d 3e 64 65 | 73 74 52 65 63 74 2e 6c | pWE->de|stRect.l|
|00003640| 65 66 74 3b 0d 09 5f 57 | 45 53 65 67 6d 65 6e 74 |eft;.._W|ESegment|
|00003650| 4c 6f 6f 70 28 66 69 72 | 73 74 4c 69 6e 65 2c 20 |Loop(fir|stLine, |
|00003660| 6c 61 73 74 4c 69 6e 65 | 2c 20 53 4c 43 61 6c 63 |lastLine|, SLCalc|
|00003670| 53 6c 6f 70 2c 20 26 63 | 64 2c 20 68 57 45 29 3b |Slop, &c|d, hWE);|
|00003680| 0d 7d 0d 0d 70 61 73 63 | 61 6c 20 76 6f 69 64 20 |.}..pasc|al void |
|00003690| 57 45 53 65 74 41 6c 69 | 67 6e 6d 65 6e 74 28 57 |WESetAli|gnment(W|
|000036a0| 45 41 6c 69 67 6e 6d 65 | 6e 74 20 61 6c 69 67 6e |EAlignme|nt align|
|000036b0| 6d 65 6e 74 2c 20 57 45 | 48 61 6e 64 6c 65 20 68 |ment, WE|Handle h|
|000036c0| 57 45 29 0d 7b 0d 09 57 | 45 50 74 72 20 70 57 45 |WE).{..W|EPtr pWE|
|000036d0| 3b 0d 09 57 45 41 6c 69 | 67 6e 6d 65 6e 74 20 6f |;..WEAli|gnment o|
|000036e0| 6c 64 41 6c 69 67 6e 6d | 65 6e 74 3b 0d 09 42 6f |ldAlignm|ent;..Bo|
|000036f0| 6f 6c 65 61 6e 20 73 61 | 76 65 57 45 4c 6f 63 6b |olean sa|veWELock|
|00003700| 3b 0d 0d 09 2f 2f 20 6c | 6f 63 6b 20 74 68 65 20 |;...// l|ock the |
|00003710| 57 45 20 72 65 63 6f 72 | 64 0d 09 73 61 76 65 57 |WE recor|d..saveW|
|00003720| 45 4c 6f 63 6b 20 3d 20 | 5f 57 45 53 65 74 48 61 |ELock = |_WESetHa|
|00003730| 6e 64 6c 65 4c 6f 63 6b | 28 28 48 61 6e 64 6c 65 |ndleLock|((Handle|
|00003740| 29 20 68 57 45 2c 20 74 | 72 75 65 29 3b 0d 09 70 |) hWE, t|rue);..p|
|00003750| 57 45 20 3d 20 2a 68 57 | 45 3b 0d 09 6f 6c 64 41 |WE = *hW|E;..oldA|
|00003760| 6c 69 67 6e 6d 65 6e 74 | 20 3d 20 70 57 45 2d 3e |lignment| = pWE->|
|00003770| 61 6c 69 67 6e 6d 65 6e | 74 3b 0d 0d 09 69 66 20 |alignmen|t;...if |
|00003780| 28 28 61 6c 69 67 6e 6d | 65 6e 74 20 3e 3d 20 77 |((alignm|ent >= w|
|00003790| 65 46 6c 75 73 68 4c 65 | 66 74 29 20 26 26 20 28 |eFlushLe|ft) && (|
|000037a0| 61 6c 69 67 6e 6d 65 6e | 74 20 3c 3d 20 77 65 4a |alignmen|t <= weJ|
|000037b0| 75 73 74 69 66 79 29 20 | 26 26 20 28 61 6c 69 67 |ustify) |&& (alig|
|000037c0| 6e 6d 65 6e 74 20 21 3d | 20 6f 6c 64 41 6c 69 67 |nment !=| oldAlig|
|000037d0| 6e 6d 65 6e 74 29 29 0d | 09 7b 0d 09 09 2f 2f 20 |nment)).|.{...// |
|000037e0| 68 69 64 65 20 74 68 65 | 20 63 61 72 65 74 20 69 |hide the| caret i|
|000037f0| 66 20 69 74 27 73 20 73 | 68 6f 77 69 6e 67 0d 09 |f it's s|howing..|
|00003800| 09 69 66 20 28 42 54 53 | 54 28 70 57 45 2d 3e 66 |.if (BTS|T(pWE->f|
|00003810| 6c 61 67 73 2c 20 77 65 | 46 43 61 72 65 74 56 69 |lags, we|FCaretVi|
|00003820| 73 69 62 6c 65 29 29 0d | 09 09 7b 0d 09 09 09 5f |sible)).|..{...._|
|00003830| 57 45 42 6c 69 6e 6b 43 | 61 72 65 74 28 68 57 45 |WEBlinkC|aret(hWE|
|00003840| 29 3b 0d 09 09 7d 0d 0d | 09 09 2f 2f 20 63 68 61 |);...}..|..// cha|
|00003850| 6e 67 65 20 74 68 65 20 | 61 6c 69 67 6e 6d 65 6e |nge the |alignmen|
|00003860| 74 0d 09 09 70 57 45 2d | 3e 61 6c 69 67 6e 6d 65 |t...pWE-|>alignme|
|00003870| 6e 74 20 3d 20 61 6c 69 | 67 6e 6d 65 6e 74 3b 0d |nt = ali|gnment;.|
|00003880| 0d 09 09 69 66 20 28 21 | 20 42 54 53 54 28 70 57 |...if (!| BTST(pW|
|00003890| 45 2d 3e 66 65 61 74 75 | 72 65 73 2c 20 77 65 46 |E->featu|res, weF|
|000038a0| 49 6e 68 69 62 69 74 52 | 65 63 61 6c 29 29 0d 09 |InhibitR|ecal))..|
|000038b0| 09 7b 0d 09 09 09 2f 2f | 20 69 66 20 74 68 65 20 |.{....//| if the |
|000038c0| 74 65 78 74 20 77 61 73 | 20 6c 65 66 74 2d 61 6c |text was| left-al|
|000038d0| 69 67 6e 65 64 2c 20 74 | 68 65 6e 20 77 65 20 68 |igned, t|hen we h|
|000038e0| 61 76 65 6e 27 74 20 62 | 65 65 6e 20 62 6f 74 68 |aven't b|een both|
|000038f0| 65 72 69 6e 67 20 74 69 | 6c 6c 20 6e 6f 77 2c 0d |ering ti|ll now,.|
|00003900| 09 09 09 2f 2f 20 73 6f | 20 77 65 20 68 61 76 65 |...// so| we have|
|00003910| 20 74 6f 20 72 65 63 61 | 6c 63 20 74 68 65 20 77 | to reca|lc the w|
|00003920| 68 6f 6c 65 20 64 6f 63 | 75 6d 65 6e 74 0d 09 09 |hole doc|ument...|
|00003930| 09 69 66 20 28 6f 6c 64 | 41 6c 69 67 6e 6d 65 6e |.if (old|Alignmen|
|00003940| 74 20 3d 3d 20 77 65 46 | 6c 75 73 68 4c 65 66 74 |t == weF|lushLeft|
|00003950| 29 0d 09 09 09 7b 0d 09 | 09 09 09 5f 57 45 52 65 |)....{..|..._WERe|
|00003960| 63 61 6c 53 6c 6f 70 73 | 28 30 2c 20 70 57 45 2d |calSlops|(0, pWE-|
|00003970| 3e 6e 4c 69 6e 65 73 20 | 2d 20 31 2c 20 68 57 45 |>nLines |- 1, hWE|
|00003980| 29 3b 0d 09 09 09 7d 0d | 0d 09 09 09 69 66 20 28 |);....}.|....if (|
|00003990| 21 20 42 54 53 54 28 70 | 57 45 2d 3e 66 65 61 74 |! BTST(p|WE->feat|
|000039a0| 75 72 65 73 2c 20 77 65 | 46 49 6e 68 69 62 69 74 |ures, we|FInhibit|
|000039b0| 52 65 64 72 61 77 29 29 | 0d 09 09 09 7b 0d 09 09 |Redraw))|....{...|
|000039c0| 09 09 2f 2f 20 72 65 64 | 72 61 77 20 74 68 65 20 |..// red|raw the |
|000039d0| 76 69 65 77 20 72 65 63 | 74 61 6e 67 6c 65 0d 09 |view rec|tangle..|
|000039e0| 09 09 09 57 45 55 70 64 | 61 74 65 28 6e 69 6c 2c |...WEUpd|ate(nil,|
|000039f0| 20 68 57 45 29 3b 0d 09 | 09 09 7d 0d 09 09 7d 0d | hWE);..|..}...}.|
|00003a00| 09 7d 0d 0d 09 2f 2f 20 | 75 6e 6c 6f 63 6b 20 74 |.}...// |unlock t|
|00003a10| 68 65 20 57 45 20 72 65 | 63 6f 72 64 0d 09 5f 57 |he WE re|cord.._W|
|00003a20| 45 53 65 74 48 61 6e 64 | 6c 65 4c 6f 63 6b 28 28 |ESetHand|leLock((|
|00003a30| 48 61 6e 64 6c 65 29 20 | 68 57 45 2c 20 73 61 76 |Handle) |hWE, sav|
|00003a40| 65 57 45 4c 6f 63 6b 29 | 3b 0d 7d 0d 0d 70 61 73 |eWELock)|;.}..pas|
|00003a50| 63 61 6c 20 76 6f 69 64 | 20 57 45 53 65 74 44 69 |cal void| WESetDi|
|00003a60| 72 65 63 74 69 6f 6e 28 | 57 45 44 69 72 65 63 74 |rection(|WEDirect|
|00003a70| 69 6f 6e 20 64 69 72 65 | 63 74 69 6f 6e 2c 20 57 |ion dire|ction, W|
|00003a80| 45 48 61 6e 64 6c 65 20 | 68 57 45 29 0d 7b 0d 09 |EHandle |hWE).{..|
|00003a90| 57 45 50 74 72 20 70 57 | 45 3b 0d 09 57 45 44 69 |WEPtr pW|E;..WEDi|
|00003aa0| 72 65 63 74 69 6f 6e 20 | 6f 6c 64 44 69 72 65 63 |rection |oldDirec|
|00003ab0| 74 69 6f 6e 3b 0d 09 42 | 6f 6f 6c 65 61 6e 20 73 |tion;..B|oolean s|
|00003ac0| 61 76 65 57 45 4c 6f 63 | 6b 3b 0d 0d 09 2f 2f 20 |aveWELoc|k;...// |
|00003ad0| 6c 6f 63 6b 20 74 68 65 | 20 57 45 20 72 65 63 6f |lock the| WE reco|
|00003ae0| 72 64 0d 09 73 61 76 65 | 57 45 4c 6f 63 6b 20 3d |rd..save|WELock =|
|00003af0| 20 5f 57 45 53 65 74 48 | 61 6e 64 6c 65 4c 6f 63 | _WESetH|andleLoc|
|00003b00| 6b 28 28 48 61 6e 64 6c | 65 29 20 68 57 45 2c 20 |k((Handl|e) hWE, |
|00003b10| 74 72 75 65 29 3b 0d 09 | 70 57 45 20 3d 20 2a 68 |true);..|pWE = *h|
|00003b20| 57 45 3b 0d 09 6f 6c 64 | 44 69 72 65 63 74 69 6f |WE;..old|Directio|
|00003b30| 6e 20 3d 20 70 57 45 2d | 3e 64 69 72 65 63 74 69 |n = pWE-|>directi|
|00003b40| 6f 6e 3b 0d 0d 09 69 66 | 20 28 28 64 69 72 65 63 |on;...if| ((direc|
|00003b50| 74 69 6f 6e 20 3e 3d 20 | 77 65 44 69 72 52 69 67 |tion >= |weDirRig|
|00003b60| 68 74 54 6f 4c 65 66 74 | 29 20 26 26 20 28 64 69 |htToLeft|) && (di|
|00003b70| 72 65 63 74 69 6f 6e 20 | 3c 3d 20 77 65 44 69 72 |rection |<= weDir|
|00003b80| 44 65 66 61 75 6c 74 29 | 20 26 26 20 28 64 69 72 |Default)| && (dir|
|00003b90| 65 63 74 69 6f 6e 20 21 | 3d 20 6f 6c 64 44 69 72 |ection !|= oldDir|
|00003ba0| 65 63 74 69 6f 6e 29 29 | 0d 09 7b 0d 09 09 2f 2f |ection))|..{...//|
|00003bb0| 20 68 69 64 65 20 74 68 | 65 20 63 61 72 65 74 20 | hide th|e caret |
|00003bc0| 69 66 20 69 74 27 73 20 | 73 68 6f 77 69 6e 67 0d |if it's |showing.|
|00003bd0| 09 09 69 66 20 28 42 54 | 53 54 28 70 57 45 2d 3e |..if (BT|ST(pWE->|
|00003be0| 66 6c 61 67 73 2c 20 77 | 65 46 43 61 72 65 74 56 |flags, w|eFCaretV|
|00003bf0| 69 73 69 62 6c 65 29 29 | 0d 09 09 7b 0d 09 09 09 |isible))|...{....|
|00003c00| 5f 57 45 42 6c 69 6e 6b | 43 61 72 65 74 28 68 57 |_WEBlink|Caret(hW|
|00003c10| 45 29 3b 0d 09 09 7d 0d | 0d 09 09 2f 2f 20 63 68 |E);...}.|...// ch|
|00003c20| 61 6e 67 65 20 74 68 65 | 20 64 69 72 65 63 74 69 |ange the| directi|
|00003c30| 6f 6e 0d 09 09 70 57 45 | 2d 3e 64 69 72 65 63 74 |on...pWE|->direct|
|00003c40| 69 6f 6e 20 3d 20 64 69 | 72 65 63 74 69 6f 6e 3b |ion = di|rection;|
|00003c50| 0d 0d 09 09 69 66 20 28 | 21 20 28 70 57 45 2d 3e |....if (|! (pWE->|
|00003c60| 66 65 61 74 75 72 65 73 | 20 26 20 28 28 31 4c 20 |features| & ((1L |
|00003c70| 3c 3c 20 77 65 46 49 6e | 68 69 62 69 74 52 65 63 |<< weFIn|hibitRec|
|00003c80| 61 6c 29 20 7c 20 28 31 | 4c 20 3c 3c 20 77 65 46 |al) | (1|L << weF|
|00003c90| 49 6e 68 69 62 69 74 52 | 65 64 72 61 77 29 29 29 |InhibitR|edraw)))|
|00003ca0| 29 0d 09 09 7b 0d 09 09 | 09 2f 2f 20 72 65 64 72 |)...{...|.// redr|
|00003cb0| 61 77 20 74 68 65 20 76 | 69 65 77 20 72 65 63 74 |aw the v|iew rect|
|00003cc0| 61 6e 67 6c 65 0d 09 09 | 09 57 45 55 70 64 61 74 |angle...|.WEUpdat|
|00003cd0| 65 28 6e 69 6c 2c 20 68 | 57 45 29 3b 0d 09 09 7d |e(nil, h|WE);...}|
|00003ce0| 0d 09 7d 0d 0d 09 2f 2f | 20 75 6e 6c 6f 63 6b 20 |..}...//| unlock |
|00003cf0| 74 68 65 20 57 45 20 72 | 65 63 6f 72 64 0d 09 5f |the WE r|ecord.._|
|00003d00| 57 45 53 65 74 48 61 6e | 64 6c 65 4c 6f 63 6b 28 |WESetHan|dleLock(|
|00003d10| 28 48 61 6e 64 6c 65 29 | 20 68 57 45 2c 20 73 61 |(Handle)| hWE, sa|
|00003d20| 76 65 57 45 4c 6f 63 6b | 29 3b 0d 7d 0d 00 00 00 |veWELock|);.}....|
|00003d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003d80| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00003d90| 00 00 00 00 00 00 ff 2a | 01 e3 a0 a0 e3 a0 e3 01 |.......*|........|
|00003da0| 01 01 01 01 08 01 f6 7f | ec 7f ec 01 7f ff 00 00 |........|........|
|00003db0| 0e 57 45 4c 69 6e 65 4c | 61 79 6f 75 74 2e 63 63 |.WELineL|ayout.cc|
|00003dc0| 20 44 42 2e 63 63 74 73 | 32 70 65 72 6f 6d 6c 6d | DB.ccts|2peromlm|
|00003dd0| 02 00 54 45 58 54 43 57 | 49 45 01 00 ff ff ff ff |..TEXTCW|IE......|
|00003de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003df0| 00 00 ab 5e 98 18 00 00 | 3b 24 00 00 01 ac 01 01 |...^....|;$......|
|00003e00| f6 01 01 08 01 01 01 01 | f6 01 f6 7f ff 00 00 00 |........|........|
|00003e10| 00 00 00 00 00 ff 2a 08 | 01 01 01 01 01 f6 d8 16 |......*.|........|
|00003e20| d8 d8 d8 d8 16 d8 01 08 | 01 01 01 80 ff 00 00 00 |........|........|
|00003e30| 00 f7 f8 f9 fa fb fc fc | ff 01 08 01 f6 01 01 f6 |........|........|
|00003e40| 01 01 08 01 01 01 01 01 | f6 08 54 fc 00 00 00 00 |........|..T.....|
|00003e50| 00 00 00 00 ff 2a 01 f6 | 01 01 01 01 01 d8 d8 d8 |.....*..|........|
|00003e60| 16 d8 d8 16 d8 d8 01 f6 | 01 01 7f ff 00 00 00 00 |........|........|
|00003e70| 00 00 f7 f8 fa fb fc ff | 08 01 08 f6 01 01 01 01 |........|........|
|00003e80| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00003e90| 07 9f d8 14 02 52 00 00 | 00 1c 00 1e ff ff 00 00 |.....R..|........|
|00003ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+